Changeset 1783
- Timestamp:
- Mar 6, 2016 6:36:17 PM (9 years ago)
- Location:
- palm/trunk/SOURCE
- Files:
-
- 33 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
palm/trunk/SOURCE/Makefile
r1780 r1783 20 20 # Current revisions: 21 21 # ------------------ 22 # 22 # name change of netcdf routines and respective dependencies 23 23 # 24 24 # Former revisions: … … 256 256 lpm_write_exchange_statistics.f90 lpm_write_restart_file.f90 \ 257 257 ls_forcing.f90 message.f90 microphysics.f90 modules.f90 mod_kinds.f90 \ 258 mod_particle_attributes.f90 netcdf .f90 nudging.f90 package_parin.f90 \259 pa lm.f90 parin.f90 plant_canopy_model.f90 pmc_interface.f90 \258 mod_particle_attributes.f90 netcdf_interface.f90 nudging.f90 \ 259 package_parin.f90 palm.f90 parin.f90 plant_canopy_model.f90 pmc_interface.f90 \ 260 260 pmc_client.f90 pmc_general.f90 pmc_handle_communicator.f90 pmc_mpi_wrapper.f90 \ 261 261 pmc_server.f90 \ … … 335 335 calc_spectra.o: modules.o cpulog.o fft_xy.o mod_kinds.o 336 336 check_for_restart.o: modules.o mod_kinds.o 337 check_open.o: modules.o mod_kinds.o mod_particle_attributes.o 338 check_parameters.o: modules.o mod_kinds.o land_surface_model.o\ 339 plant_canopy_model.o pmc_interface.o radiation_model.o subsidence.o 340 close_file.o: modules.o mod_kinds.o 337 check_open.o: modules.o mod_kinds.o mod_particle_attributes.o netcdf_interface.o 338 check_parameters.o: modules.o mod_kinds.o land_surface_model.o \ 339 netcdf_interface.o plant_canopy_model.o pmc_interface.o radiation_model.o \ 340 subsidence.o 341 close_file.o: modules.o mod_kinds.o netcdf_interface.o 341 342 compute_vpt.o: modules.o mod_kinds.o 342 343 coriolis.o: modules.o mod_kinds.o … … 346 347 data_log.o: modules.o mod_kinds.o 347 348 data_output_dvrp.o: modules.o cpulog.o mod_kinds.o 348 data_output_mask.o: modules.o cpulog.o mod_kinds.o mod_particle_attributes.o 349 data_output_profiles.o: modules.o cpulog.o mod_kinds.o 350 data_output_ptseries.o: modules.o cpulog.o mod_kinds.o mod_particle_attributes.o 351 data_output_spectra.o: modules.o cpulog.o mod_kinds.o 352 data_output_tseries.o: modules.o cpulog.o mod_kinds.o 349 data_output_mask.o: modules.o cpulog.o mod_kinds.o mod_particle_attributes.o \ 350 netcdf_interface.o 351 data_output_profiles.o: modules.o cpulog.o mod_kinds.o netcdf_interface.o 352 data_output_ptseries.o: modules.o cpulog.o mod_kinds.o \ 353 netcdf_interface.o mod_particle_attributes.o 354 data_output_spectra.o: modules.o cpulog.o mod_kinds.o netcdf_interface.o 355 data_output_tseries.o: modules.o cpulog.o mod_kinds.o netcdf_interface.o 353 356 data_output_2d.o: modules.o cpulog.o mod_kinds.o mod_particle_attributes.o\ 354 357 netcdf_interface.o land_surface_model.o radiation_model.o 355 358 data_output_3d.o: modules.o cpulog.o mod_kinds.o mod_particle_attributes.o\ 356 359 netcdf_interface.o land_surface_model.o 357 360 diffusion_e.o: modules.o mod_kinds.o 358 361 diffusion_s.o: modules.o mod_kinds.o … … 369 372 fft_xy.o: cuda_fft_interfaces.o modules.o mod_kinds.o singleton.o temperton_fft.o 370 373 flow_statistics.o: modules.o cpulog.o mod_kinds.o land_surface_model.o\ 371 374 netcdf_interface.o radiation_model.o 372 375 global_min_max.o: modules.o mod_kinds.o 373 header.o: modules.o cpulog.o mod_kinds.o land_surface_model.o\376 header.o: modules.o cpulog.o mod_kinds.o netcdf_interface.o land_surface_model.o\ 374 377 plant_canopy_model.o pmc_interface.o radiation_model.o subsidence.o 375 378 impact_of_latent_heat.o: modules.o mod_kinds.o 376 379 inflow_turbulence.o: modules.o cpulog.o mod_kinds.o 377 380 init_1d_model.o: modules.o mod_kinds.o 378 init_3d_model.o: modules.o cpulog.o mod_kinds.o random_function.o advec_ws.o\ 379 land_surface_model.o ls_forcing.o lpm_init.o plant_canopy_model.o\ 380 radiation_model.o random_generator_parallel.o surface_layer_fluxes.o 381 init_3d_model.o: modules.o mod_kinds.o advec_ws.o cpulog.o land_surface_model.o \ 382 lpm_init.o ls_forcing.o netcdf_interface.o plant_canopy_model.o \ 383 radiation_model.o random_function.o random_generator_parallel.o \ 384 surface_layer_fluxes.o 381 385 init_advec.o: modules.o mod_kinds.o 382 386 init_cloud_physics.o: modules.o mod_kinds.o … … 384 388 init_dvrp.o: modules.o mod_kinds.o 385 389 init_grid.o: modules.o mod_kinds.o 386 init_masks.o: modules.o mod_kinds.o 390 init_masks.o: modules.o mod_kinds.o netcdf_interface.o 387 391 init_ocean.o: modules.o eqn_state_seawater.o mod_kinds.o 388 392 init_pegrid.o: modules.o mod_kinds.o … … 406 410 mod_particle_attributes.o 407 411 lpm_data_output_particles.o: modules.o cpulog.o mod_kinds.o \ 408 mod_particle_attributes.o 412 mod_particle_attributes.o netcdf_interface.o 409 413 lpm_droplet_collision.o: modules.o cpulog.o lpm_collision_kernels.o \ 410 414 mod_kinds.o mod_particle_attributes.o … … 412 416 mod_kinds.o mod_particle_attributes.o 413 417 lpm_exchange_horiz.o: modules.o cpulog.o lpm_pack_arrays.o mod_kinds.o \ 414 mod_particle_attributes.o 418 mod_particle_attributes.o netcdf_interface.o 415 419 lpm_extend_tails.o: modules.o mod_kinds.o mod_particle_attributes.o 416 420 lpm_extend_tail_array.o: modules.o mod_kinds.o mod_particle_attributes.o 417 421 lpm_init.o: modules.o lpm_collision_kernels.o mod_kinds.o \ 418 random_function.o mod_particle_attributes.o lpm_exchange_horiz.o \419 lpm_ pack_arrays.o random_generator_parallel.o422 netcdf_interface.o random_function.o mod_particle_attributes.o \ 423 lpm_exchange_horiz.o lpm_pack_arrays.o random_generator_parallel.o 420 424 lpm_init_sgs_tke.o: modules.o mod_kinds.o mod_particle_attributes.o 421 425 lpm_pack_arrays.o: modules.o cpulog.o mod_kinds.o mod_particle_attributes.o … … 433 437 mod_kinds.o: mod_kinds.f90 434 438 mod_particle_attributes.o: mod_particle_attributes.f90 mod_kinds.o 435 netcdf .o:modules.o mod_kinds.o land_surface_model.o439 netcdf_interface.o: netcdf_interface.f90 modules.o mod_kinds.o land_surface_model.o 436 440 nudging.o: modules.o cpulog.o mod_kinds.o 437 441 package_parin.o: modules.o mod_kinds.o land_surface_model.o\ … … 439 443 palm.o: modules.o cpulog.o ls_forcing.o mod_kinds.o nudging.o\ 440 444 pmc_interface.o surface_layer_fluxes.o 441 parin.o: modules.o cpulog.o mod_kinds.o pmc_interface.o progress_bar.o 445 parin.o: modules.o cpulog.o mod_kinds.o netcdf_interface.o \ 446 pmc_interface.o progress_bar.o 442 447 plant_canopy_model.o: modules.o mod_kinds.o 443 448 pmc_interface.o: modules.o mod_kinds.o pmc_client.o pmc_general.o\ … … 470 475 radiation_model.o random_function.o\ 471 476 random_generator_parallel.o 472 read_var_list.o: modules.o mod_kinds.o plant_canopy_model.o477 read_var_list.o: modules.o mod_kinds.o netcdf_interface.o plant_canopy_model.o 473 478 run_control.o: modules.o cpulog.o mod_kinds.o 474 479 set_slicer_attributes_dvrp.o: modules.o mod_kinds.o … … 497 502 user_additional_routines.o: modules.o mod_kinds.o user_module.o 498 503 user_check_data_output.o: modules.o mod_kinds.o user_module.o 499 user_check_data_output_pr.o: modules.o mod_kinds.o user_module.o 504 user_check_data_output_pr.o: modules.o mod_kinds.o user_module.o \ 505 netcdf_interface.o 500 506 user_check_parameters.o: modules.o mod_kinds.o user_module.o 501 507 user_data_output_2d.o: modules.o mod_kinds.o user_module.o … … 506 512 user_dvrp_coltab.o: modules.o mod_kinds.o user_module.o 507 513 user_header.o: modules.o mod_kinds.o user_module.o 508 user_init.o: modules.o mod_kinds.o user_module.o514 user_init.o: modules.o mod_kinds.o netcdf_interface.o user_module.o 509 515 user_init_3d_model.o: modules.o mod_kinds.o user_module.o 510 516 user_init_grid.o: modules.o mod_kinds.o user_module.o … … 520 526 user_read_restart_data.o: modules.o mod_kinds.o user_module.o 521 527 user_spectra.o: modules.o mod_kinds.o user_module.o 522 user_statistics.o: modules.o mod_kinds.o user_module.o528 user_statistics.o: modules.o mod_kinds.o netcdf_interface.o user_module.o 523 529 wall_fluxes.o: modules.o mod_kinds.o 524 530 write_3d_binary.o: modules.o cpulog.o mod_kinds.o land_surface_model.o\ 525 531 radiation_model.o random_function.o\ 526 532 random_generator_parallel.o 527 write_var_list.o: modules.o mod_kinds.o plant_canopy_model.o533 write_var_list.o: modules.o mod_kinds.o netcdf_interface.o plant_canopy_model.o -
palm/trunk/SOURCE/check_open.f90
r1780 r1783 19 19 ! Current revisions: 20 20 ! ----------------- 21 ! 21 ! name change of netcdf routines and module + related changes 22 22 ! 23 23 ! Former revisions: … … 106 106 USE control_parameters, & 107 107 ONLY: avs_data_file, coupling_char, data_output_2d_on_each_pe, host, & 108 m essage_string, mid, netcdf_data_format, nz_do3d, openfile,&108 max_masks, message_string, mid, nz_do3d, openfile, & 109 109 return_addres, return_username, run_description_header, runnr 110 110 … … 117 117 USE kinds 118 118 119 USE netcdf_control 119 #if defined( __netcdf ) 120 USE NETCDF 121 #endif 122 123 USE netcdf_interface, & 124 ONLY: id_set_mask, id_set_pr, id_set_prt, id_set_pts, id_set_sp, & 125 id_set_ts, id_set_xy, id_set_xz, id_set_yz, id_set_3d, nc_stat, & 126 netcdf_create_file, netcdf_data_format, netcdf_define_header, & 127 netcdf_handle_error, netcdf_open_write_file 120 128 121 129 USE particle_attributes, & … … 649 657 ! 650 658 !-- Open an existing netCDF file for output 651 CALL open_write_netcdf_file( filename, id_set_xy(av), .TRUE., 20 )659 CALL netcdf_open_write_file( filename, id_set_xy(av), .TRUE., 20 ) 652 660 ! 653 661 !-- Read header information and set all ids. If there is a mismatch 654 662 !-- between the previuos and the actual run, netcdf_extend is returned 655 663 !-- as .FALSE. 656 CALL define_netcdf_header( 'xy', netcdf_extend, av )664 CALL netcdf_define_header( 'xy', netcdf_extend, av ) 657 665 658 666 ! … … 660 668 IF ( .NOT. netcdf_extend ) THEN 661 669 nc_stat = NF90_CLOSE( id_set_xy(av) ) 662 CALL handle_netcdf_error( 'check_open', 21 )670 CALL netcdf_handle_error( 'check_open', 21 ) 663 671 IF ( myid == 0 ) CALL local_system( 'rm ' // TRIM( filename ) ) 664 672 #if defined( __parallel ) && ! defined ( __check ) … … 675 683 ! 676 684 !-- Create a new netCDF output file with requested netCDF format 677 CALL create_netcdf_file( filename, id_set_xy(av), .TRUE., 22 )685 CALL netcdf_create_file( filename, id_set_xy(av), .TRUE., 22 ) 678 686 679 687 ! 680 688 !-- Define the header 681 CALL define_netcdf_header( 'xy', netcdf_extend, av )689 CALL netcdf_define_header( 'xy', netcdf_extend, av ) 682 690 683 691 ! … … 711 719 ! 712 720 !-- Open an existing netCDF file for output 713 CALL open_write_netcdf_file( filename, id_set_xz(av), .TRUE., 23 )721 CALL netcdf_open_write_file( filename, id_set_xz(av), .TRUE., 23 ) 714 722 ! 715 723 !-- Read header information and set all ids. If there is a mismatch 716 724 !-- between the previuos and the actual run, netcdf_extend is returned 717 725 !-- as .FALSE. 718 CALL define_netcdf_header( 'xz', netcdf_extend, av )726 CALL netcdf_define_header( 'xz', netcdf_extend, av ) 719 727 720 728 ! … … 722 730 IF ( .NOT. netcdf_extend ) THEN 723 731 nc_stat = NF90_CLOSE( id_set_xz(av) ) 724 CALL handle_netcdf_error( 'check_open', 24 )732 CALL netcdf_handle_error( 'check_open', 24 ) 725 733 IF ( myid == 0 ) CALL local_system( 'rm ' // TRIM( filename ) ) 726 734 #if defined( __parallel ) && ! defined ( __check ) … … 737 745 ! 738 746 !-- Create a new netCDF output file with requested netCDF format 739 CALL create_netcdf_file( filename, id_set_xz(av), .TRUE., 25 )747 CALL netcdf_create_file( filename, id_set_xz(av), .TRUE., 25 ) 740 748 741 749 ! 742 750 !-- Define the header 743 CALL define_netcdf_header( 'xz', netcdf_extend, av )751 CALL netcdf_define_header( 'xz', netcdf_extend, av ) 744 752 745 753 ! … … 773 781 ! 774 782 !-- Open an existing netCDF file for output 775 CALL open_write_netcdf_file( filename, id_set_yz(av), .TRUE., 26 )783 CALL netcdf_open_write_file( filename, id_set_yz(av), .TRUE., 26 ) 776 784 ! 777 785 !-- Read header information and set all ids. If there is a mismatch 778 786 !-- between the previuos and the actual run, netcdf_extend is returned 779 787 !-- as .FALSE. 780 CALL define_netcdf_header( 'yz', netcdf_extend, av )788 CALL netcdf_define_header( 'yz', netcdf_extend, av ) 781 789 782 790 ! … … 784 792 IF ( .NOT. netcdf_extend ) THEN 785 793 nc_stat = NF90_CLOSE( id_set_yz(av) ) 786 CALL handle_netcdf_error( 'check_open', 27 )794 CALL netcdf_handle_error( 'check_open', 27 ) 787 795 IF ( myid == 0 ) CALL local_system( 'rm ' // TRIM( filename ) ) 788 796 #if defined( __parallel ) && ! defined ( __check ) … … 799 807 ! 800 808 !-- Create a new netCDF output file with requested netCDF format 801 CALL create_netcdf_file( filename, id_set_yz(av), .TRUE., 28 )809 CALL netcdf_create_file( filename, id_set_yz(av), .TRUE., 28 ) 802 810 803 811 ! 804 812 !-- Define the header 805 CALL define_netcdf_header( 'yz', netcdf_extend, av )813 CALL netcdf_define_header( 'yz', netcdf_extend, av ) 806 814 807 815 ! … … 829 837 ! 830 838 !-- Open an existing netCDF file for output 831 CALL open_write_netcdf_file( filename, id_set_pr, .FALSE., 29 )839 CALL netcdf_open_write_file( filename, id_set_pr, .FALSE., 29 ) 832 840 ! 833 841 !-- Read header information and set all ids. If there is a mismatch 834 842 !-- between the previuos and the actual run, netcdf_extend is returned 835 843 !-- as .FALSE. 836 CALL define_netcdf_header( 'pr', netcdf_extend, 0 )844 CALL netcdf_define_header( 'pr', netcdf_extend, 0 ) 837 845 838 846 ! … … 840 848 IF ( .NOT. netcdf_extend ) THEN 841 849 nc_stat = NF90_CLOSE( id_set_pr ) 842 CALL handle_netcdf_error( 'check_open', 30 )850 CALL netcdf_handle_error( 'check_open', 30 ) 843 851 CALL local_system( 'rm ' // TRIM( filename ) ) 844 852 ENDIF … … 849 857 ! 850 858 !-- Create a new netCDF output file with requested netCDF format 851 CALL create_netcdf_file( filename, id_set_pr, .FALSE., 31 )859 CALL netcdf_create_file( filename, id_set_pr, .FALSE., 31 ) 852 860 ! 853 861 !-- Define the header 854 CALL define_netcdf_header( 'pr', netcdf_extend, 0 )862 CALL netcdf_define_header( 'pr', netcdf_extend, 0 ) 855 863 856 864 ENDIF … … 869 877 ! 870 878 !-- Open an existing netCDF file for output 871 CALL open_write_netcdf_file( filename, id_set_ts, .FALSE., 32 )879 CALL netcdf_open_write_file( filename, id_set_ts, .FALSE., 32 ) 872 880 ! 873 881 !-- Read header information and set all ids. If there is a mismatch 874 882 !-- between the previuos and the actual run, netcdf_extend is returned 875 883 !-- as .FALSE. 876 CALL define_netcdf_header( 'ts', netcdf_extend, 0 )884 CALL netcdf_define_header( 'ts', netcdf_extend, 0 ) 877 885 878 886 ! … … 880 888 IF ( .NOT. netcdf_extend ) THEN 881 889 nc_stat = NF90_CLOSE( id_set_ts ) 882 CALL handle_netcdf_error( 'check_open', 33 )890 CALL netcdf_handle_error( 'check_open', 33 ) 883 891 CALL local_system( 'rm ' // TRIM( filename ) ) 884 892 ENDIF … … 889 897 ! 890 898 !-- Create a new netCDF output file with requested netCDF format 891 CALL create_netcdf_file( filename, id_set_ts, .FALSE., 34 )899 CALL netcdf_create_file( filename, id_set_ts, .FALSE., 34 ) 892 900 ! 893 901 !-- Define the header 894 CALL define_netcdf_header( 'ts', netcdf_extend, 0 )902 CALL netcdf_define_header( 'ts', netcdf_extend, 0 ) 895 903 896 904 ENDIF … … 916 924 ! 917 925 !-- Open an existing netCDF file for output 918 CALL open_write_netcdf_file( filename, id_set_3d(av), .TRUE., 35 )926 CALL netcdf_open_write_file( filename, id_set_3d(av), .TRUE., 35 ) 919 927 ! 920 928 !-- Read header information and set all ids. If there is a mismatch 921 929 !-- between the previuos and the actual run, netcdf_extend is returned 922 930 !-- as .FALSE. 923 CALL define_netcdf_header( '3d', netcdf_extend, av )931 CALL netcdf_define_header( '3d', netcdf_extend, av ) 924 932 925 933 ! … … 927 935 IF ( .NOT. netcdf_extend ) THEN 928 936 nc_stat = NF90_CLOSE( id_set_3d(av) ) 929 CALL handle_netcdf_error( 'check_open', 36 )937 CALL netcdf_handle_error( 'check_open', 36 ) 930 938 IF ( myid == 0 ) CALL local_system( 'rm ' // TRIM( filename ) ) 931 939 #if defined( __parallel ) && ! defined ( __check ) … … 943 951 ! 944 952 !-- Create a new netCDF output file with requested netCDF format 945 CALL create_netcdf_file( filename, id_set_3d(av), .TRUE., 37 )953 CALL netcdf_create_file( filename, id_set_3d(av), .TRUE., 37 ) 946 954 947 955 ! 948 956 !-- Define the header 949 CALL define_netcdf_header( '3d', netcdf_extend, av )957 CALL netcdf_define_header( '3d', netcdf_extend, av ) 950 958 951 959 ! … … 974 982 ! 975 983 !-- Open an existing netCDF file for output 976 CALL open_write_netcdf_file( filename, id_set_sp, .FALSE., 38 )984 CALL netcdf_open_write_file( filename, id_set_sp, .FALSE., 38 ) 977 985 978 986 ! … … 980 988 !-- between the previuos and the actual run, netcdf_extend is returned 981 989 !-- as .FALSE. 982 CALL define_netcdf_header( 'sp', netcdf_extend, 0 )990 CALL netcdf_define_header( 'sp', netcdf_extend, 0 ) 983 991 984 992 ! … … 986 994 IF ( .NOT. netcdf_extend ) THEN 987 995 nc_stat = NF90_CLOSE( id_set_sp ) 988 CALL handle_netcdf_error( 'check_open', 39 )996 CALL netcdf_handle_error( 'check_open', 39 ) 989 997 CALL local_system( 'rm ' // TRIM( filename ) ) 990 998 ENDIF … … 995 1003 ! 996 1004 !-- Create a new netCDF output file with requested netCDF format 997 CALL create_netcdf_file( filename, id_set_sp, .FALSE., 40 )1005 CALL netcdf_create_file( filename, id_set_sp, .FALSE., 40 ) 998 1006 ! 999 1007 !-- Define the header 1000 CALL define_netcdf_header( 'sp', netcdf_extend, 0 )1008 CALL netcdf_define_header( 'sp', netcdf_extend, 0 ) 1001 1009 1002 1010 ENDIF … … 1019 1027 ! 1020 1028 !-- Open an existing netCDF file for output 1021 CALL open_write_netcdf_file( filename, id_set_prt, .FALSE., 41 )1029 CALL netcdf_open_write_file( filename, id_set_prt, .FALSE., 41 ) 1022 1030 ! 1023 1031 !-- Read header information and set all ids. If there is a mismatch 1024 1032 !-- between the previuos and the actual run, netcdf_extend is returned 1025 1033 !-- as .FALSE. 1026 CALL define_netcdf_header( 'pt', netcdf_extend, 0 )1034 CALL netcdf_define_header( 'pt', netcdf_extend, 0 ) 1027 1035 1028 1036 ! … … 1030 1038 IF ( .NOT. netcdf_extend ) THEN 1031 1039 nc_stat = NF90_CLOSE( id_set_prt ) 1032 CALL handle_netcdf_error( 'check_open', 42 )1040 CALL netcdf_handle_error( 'check_open', 42 ) 1033 1041 CALL local_system( 'rm ' // TRIM( filename ) ) 1034 1042 ENDIF … … 1056 1064 ! 1057 1065 !-- Create a new netCDF output file with requested netCDF format 1058 CALL create_netcdf_file( filename, id_set_prt, .FALSE., 43 )1066 CALL netcdf_create_file( filename, id_set_prt, .FALSE., 43 ) 1059 1067 1060 1068 ! 1061 1069 !-- Define the header 1062 CALL define_netcdf_header( 'pt', netcdf_extend, 0 )1070 CALL netcdf_define_header( 'pt', netcdf_extend, 0 ) 1063 1071 1064 1072 ENDIF … … 1077 1085 ! 1078 1086 !-- Open an existing netCDF file for output 1079 CALL open_write_netcdf_file( filename, id_set_pts, .FALSE., 393 )1087 CALL netcdf_open_write_file( filename, id_set_pts, .FALSE., 393 ) 1080 1088 ! 1081 1089 !-- Read header information and set all ids. If there is a mismatch 1082 1090 !-- between the previuos and the actual run, netcdf_extend is returned 1083 1091 !-- as .FALSE. 1084 CALL define_netcdf_header( 'ps', netcdf_extend, 0 )1092 CALL netcdf_define_header( 'ps', netcdf_extend, 0 ) 1085 1093 1086 1094 ! … … 1088 1096 IF ( .NOT. netcdf_extend ) THEN 1089 1097 nc_stat = NF90_CLOSE( id_set_pts ) 1090 CALL handle_netcdf_error( 'check_open', 394 )1098 CALL netcdf_handle_error( 'check_open', 394 ) 1091 1099 CALL local_system( 'rm ' // TRIM( filename ) ) 1092 1100 ENDIF … … 1097 1105 ! 1098 1106 !-- Create a new netCDF output file with requested netCDF format 1099 CALL create_netcdf_file( filename, id_set_pts, .FALSE., 395 )1107 CALL netcdf_create_file( filename, id_set_pts, .FALSE., 395 ) 1100 1108 ! 1101 1109 !-- Define the header 1102 CALL define_netcdf_header( 'ps', netcdf_extend, 0 )1110 CALL netcdf_define_header( 'ps', netcdf_extend, 0 ) 1103 1111 1104 1112 ENDIF … … 1138 1146 ! 1139 1147 !-- Open an existing netCDF file for output 1140 CALL open_write_netcdf_file( filename, id_set_mask(mid,av), &1148 CALL netcdf_open_write_file( filename, id_set_mask(mid,av), & 1141 1149 .TRUE., 456 ) 1142 1150 ! … … 1144 1152 !-- between the previuos and the actual run, netcdf_extend is returned 1145 1153 !-- as .FALSE. 1146 CALL define_netcdf_header( 'ma', netcdf_extend, file_id )1154 CALL netcdf_define_header( 'ma', netcdf_extend, file_id ) 1147 1155 1148 1156 ! … … 1150 1158 IF ( .NOT. netcdf_extend ) THEN 1151 1159 nc_stat = NF90_CLOSE( id_set_mask(mid,av) ) 1152 CALL handle_netcdf_error( 'check_open', 457 )1160 CALL netcdf_handle_error( 'check_open', 457 ) 1153 1161 CALL local_system('rm ' // TRIM( filename ) ) 1154 1162 ENDIF … … 1159 1167 ! 1160 1168 !-- Create a new netCDF output file with requested netCDF format 1161 CALL create_netcdf_file( filename, id_set_mask(mid,av), .TRUE., 458 )1169 CALL netcdf_create_file( filename, id_set_mask(mid,av), .TRUE., 458 ) 1162 1170 ! 1163 1171 !-- Define the header 1164 CALL define_netcdf_header( 'ma', netcdf_extend, file_id )1172 CALL netcdf_define_header( 'ma', netcdf_extend, file_id ) 1165 1173 1166 1174 ENDIF -
palm/trunk/SOURCE/check_parameters.f90
r1765 r1783 19 19 ! Current revisions: 20 20 ! ----------------- 21 ! 21 ! netcdf variables and module name changed, 22 ! check of netcdf precision removed (is done in the netcdf module) 22 23 ! 23 24 ! Former revisions: … … 312 313 USE kinds 313 314 USE model_1d 314 USE netcdf_control 315 USE netcdf_interface, & 316 ONLY: dopr_unit, do2d_unit, do3d_unit, netcdf_data_format, & 317 netcdf_data_format_string 315 318 USE particle_attributes 316 319 USE pegrid … … 350 353 351 354 LOGICAL :: found !< 352 LOGICAL :: ldum !<353 355 354 356 REAL(wp) :: gradient !< … … 3733 3735 SELECT CASE ( netcdf_data_format ) 3734 3736 CASE ( 1 ) 3735 output_format_netcdf= 'netCDF classic'3737 netcdf_data_format_string = 'netCDF classic' 3736 3738 CASE ( 2 ) 3737 output_format_netcdf= 'netCDF 64bit offset'3739 netcdf_data_format_string = 'netCDF 64bit offset' 3738 3740 CASE ( 3 ) 3739 output_format_netcdf= 'netCDF4/HDF5'3741 netcdf_data_format_string = 'netCDF4/HDF5' 3740 3742 CASE ( 4 ) 3741 output_format_netcdf= 'netCDF4/HDF5 classic'3743 netcdf_data_format_string = 'netCDF4/HDF5 classic' 3742 3744 CASE ( 5 ) 3743 output_format_netcdf= 'parallel netCDF4/HDF5'3745 netcdf_data_format_string = 'parallel netCDF4/HDF5' 3744 3746 CASE ( 6 ) 3745 output_format_netcdf= 'parallel netCDF4/HDF5 classic'3747 netcdf_data_format_string = 'parallel netCDF4/HDF5 classic' 3746 3748 3747 3749 END SELECT … … 3864 3866 ENDIF 3865 3867 3866 #if ! defined( __check )3867 !3868 !-- Check netcdf precison3869 ldum = .FALSE.3870 CALL define_netcdf_header( 'ch', ldum, 0 )3871 #endif3872 3868 ! 3873 3869 !-- Check, whether a constant diffusion coefficient shall be used -
palm/trunk/SOURCE/close_file.f90
r1683 r1783 19 19 ! Current revisions: 20 20 ! ----------------- 21 ! 21 ! name change of netcdf routines and module + related changes 22 22 ! 23 23 ! Former revisions: … … 65 65 66 66 USE control_parameters, & 67 ONLY: do2d_xz_n, do2d_xy_n, do2d_yz_n, do3d_avs_n, & 68 host, max_masks, mid, netcdf_data_format, & 69 nz_do3d, openfile, run_description_header, & 70 z_max_do2d 67 ONLY: do2d_xz_n, do2d_xy_n, do2d_yz_n, do3d_avs_n, host, max_masks, & 68 mid, nz_do3d, openfile, run_description_header, z_max_do2d 71 69 72 70 USE grid_variables, & … … 78 76 USE kinds 79 77 80 USE netcdf_control 78 #if defined( __netcdf ) 79 USE NETCDF 80 #endif 81 82 USE netcdf_interface, & 83 ONLY: id_set_mask, id_set_pr, id_set_prt, id_set_pts, id_set_sp, & 84 id_set_ts, id_set_xy, id_set_xz, id_set_yz, id_set_3d, nc_stat, & 85 netcdf_data_format, netcdf_handle_error 81 86 82 87 USE pegrid … … 132 137 IF ( myid == 0 .OR. netcdf_data_format > 4 ) THEN 133 138 nc_stat = NF90_CLOSE( id_set_xy(0) ) 134 CALL handle_netcdf_error( 'close_file', 44 )139 CALL netcdf_handle_error( 'close_file', 44 ) 135 140 ENDIF 136 141 … … 139 144 IF ( myid == 0 .OR. netcdf_data_format > 4 ) THEN 140 145 nc_stat = NF90_CLOSE( id_set_xz(0) ) 141 CALL handle_netcdf_error( 'close_file', 45 )146 CALL netcdf_handle_error( 'close_file', 45 ) 142 147 ENDIF 143 148 … … 146 151 IF ( myid == 0 .OR. netcdf_data_format > 4 ) THEN 147 152 nc_stat = NF90_CLOSE( id_set_yz(0) ) 148 CALL handle_netcdf_error( 'close_file', 46 )153 CALL netcdf_handle_error( 'close_file', 46 ) 149 154 ENDIF 150 155 … … 153 158 IF ( myid == 0 ) THEN 154 159 nc_stat = NF90_CLOSE( id_set_pr ) 155 CALL handle_netcdf_error( 'close_file', 47 )160 CALL netcdf_handle_error( 'close_file', 47 ) 156 161 ENDIF 157 162 … … 160 165 IF ( myid == 0 ) THEN 161 166 nc_stat = NF90_CLOSE( id_set_ts ) 162 CALL handle_netcdf_error( 'close_file', 48 )167 CALL netcdf_handle_error( 'close_file', 48 ) 163 168 ENDIF 164 169 … … 167 172 IF ( myid == 0 .OR. netcdf_data_format > 4 ) THEN 168 173 nc_stat = NF90_CLOSE( id_set_3d(0) ) 169 CALL handle_netcdf_error( 'close_file', 49 )174 CALL netcdf_handle_error( 'close_file', 49 ) 170 175 ENDIF 171 176 … … 174 179 IF ( myid == 0 ) THEN 175 180 nc_stat = NF90_CLOSE( id_set_sp ) 176 CALL handle_netcdf_error( 'close_file', 50 )181 CALL netcdf_handle_error( 'close_file', 50 ) 177 182 ENDIF 178 183 … … 180 185 181 186 nc_stat = NF90_CLOSE( id_set_prt ) 182 CALL handle_netcdf_error( 'close_file', 51 )187 CALL netcdf_handle_error( 'close_file', 51 ) 183 188 184 189 CASE ( 109 ) 185 190 186 191 nc_stat = NF90_CLOSE( id_set_pts ) 187 CALL handle_netcdf_error( 'close_file', 412 )192 CALL netcdf_handle_error( 'close_file', 412 ) 188 193 189 194 CASE ( 111 ) … … 191 196 IF ( myid == 0 .OR. netcdf_data_format > 4 ) THEN 192 197 nc_stat = NF90_CLOSE( id_set_xy(1) ) 193 CALL handle_netcdf_error( 'close_file', 52 )198 CALL netcdf_handle_error( 'close_file', 52 ) 194 199 ENDIF 195 200 … … 198 203 IF ( myid == 0 .OR. netcdf_data_format > 4 ) THEN 199 204 nc_stat = NF90_CLOSE( id_set_xz(1) ) 200 CALL handle_netcdf_error( 'close_file', 352 )205 CALL netcdf_handle_error( 'close_file', 352 ) 201 206 ENDIF 202 207 … … 205 210 IF ( myid == 0 .OR. netcdf_data_format > 4 ) THEN 206 211 nc_stat = NF90_CLOSE( id_set_yz(1) ) 207 CALL handle_netcdf_error( 'close_file', 353 )212 CALL netcdf_handle_error( 'close_file', 353 ) 208 213 ENDIF 209 214 … … 212 217 IF ( myid == 0 .OR. netcdf_data_format > 4 ) THEN 213 218 nc_stat = NF90_CLOSE( id_set_3d(1) ) 214 CALL handle_netcdf_error( 'close_file', 353 )219 CALL netcdf_handle_error( 'close_file', 353 ) 215 220 ENDIF 216 221 … … 228 233 ENDIF 229 234 nc_stat = NF90_CLOSE( id_set_mask(mid,av) ) 230 CALL handle_netcdf_error( 'close_file', 459 )235 CALL netcdf_handle_error( 'close_file', 459 ) 231 236 232 237 ENDIF -
palm/trunk/SOURCE/data_output_2d.f90
r1746 r1783 19 19 ! Current revisions: 20 20 ! ----------------- 21 ! 21 ! name change of netcdf routines and module + related changes 22 22 ! 23 23 ! Former revisions: … … 141 141 do2d_yz_last_time, do2d_yz_n, do2d_yz_time_count, & 142 142 ibc_uv_b, icloud_scheme, io_blocks, io_group, & 143 message_string, netcdf_data_format,&143 message_string, & 144 144 ntdim_2d_xy, ntdim_2d_xz, ntdim_2d_yz, psolver, section, & 145 145 simulated_time, simulated_time_chr, time_since_reference_point … … 165 165 shf_eb_av, t_soil, t_soil_av, zs 166 166 167 USE netcdf_control 167 #if defined( __netcdf ) 168 USE NETCDF 169 #endif 170 171 USE netcdf_interface, & 172 ONLY: id_set_xy, id_set_xz, id_set_yz, id_var_do2d, id_var_time_xy, & 173 id_var_time_xz, id_var_time_yz, nc_stat, netcdf_data_format, & 174 netcdf_handle_error 168 175 169 176 USE particle_attributes, & … … 1322 1329 start = (/ do2d_xy_time_count(av) /), & 1323 1330 count = (/ 1 /) ) 1324 CALL handle_netcdf_error( 'data_output_2d', 53 )1331 CALL netcdf_handle_error( 'data_output_2d', 53 ) 1325 1332 #endif 1326 1333 ENDIF … … 1443 1450 count = (/ nx+2, ny+2, 1, 1 /) ) 1444 1451 ENDIF 1445 CALL handle_netcdf_error( 'data_output_2d', 54 )1452 CALL netcdf_handle_error( 'data_output_2d', 54 ) 1446 1453 #endif 1447 1454 … … 1481 1488 count = (/ nx+2, ny+2, 1, 1 /) ) 1482 1489 ENDIF 1483 CALL handle_netcdf_error( 'data_output_2d', 447 )1490 CALL netcdf_handle_error( 'data_output_2d', 447 ) 1484 1491 #endif 1485 1492 #endif … … 1511 1518 start = (/ do2d_xz_time_count(av) /), & 1512 1519 count = (/ 1 /) ) 1513 CALL handle_netcdf_error( 'data_output_2d', 56 )1520 CALL netcdf_handle_error( 'data_output_2d', 56 ) 1514 1521 #endif 1515 1522 ENDIF … … 1666 1673 start = (/ 1, is, 1, do2d_xz_time_count(av) /), & 1667 1674 count = (/ nx+2, 1, nzt_do-nzb_do+1, 1 /) ) 1668 CALL handle_netcdf_error( 'data_output_2d', 58 )1675 CALL netcdf_handle_error( 'data_output_2d', 58 ) 1669 1676 #endif 1670 1677 … … 1707 1714 start = (/ 1, is, 1, do2d_xz_time_count(av) /), & 1708 1715 count = (/ nx+2, 1, nzt_do-nzb_do+1, 1 /) ) 1709 CALL handle_netcdf_error( 'data_output_2d', 451 )1716 CALL netcdf_handle_error( 'data_output_2d', 451 ) 1710 1717 #endif 1711 1718 #endif … … 1730 1737 start = (/ do2d_yz_time_count(av) /), & 1731 1738 count = (/ 1 /) ) 1732 CALL handle_netcdf_error( 'data_output_2d', 59 )1739 CALL netcdf_handle_error( 'data_output_2d', 59 ) 1733 1740 #endif 1734 1741 ENDIF … … 1885 1892 start = (/ is, 1, 1, do2d_yz_time_count(av) /), & 1886 1893 count = (/ 1, ny+2, nzt_do-nzb_do+1, 1 /) ) 1887 CALL handle_netcdf_error( 'data_output_2d', 61 )1894 CALL netcdf_handle_error( 'data_output_2d', 61 ) 1888 1895 #endif 1889 1896 … … 1926 1933 start = (/ is, 1, 1, do2d_xz_time_count(av) /), & 1927 1934 count = (/ 1, ny+2, nzt_do-nzb_do+1, 1 /) ) 1928 CALL handle_netcdf_error( 'data_output_2d', 452 )1935 CALL netcdf_handle_error( 'data_output_2d', 452 ) 1929 1936 #endif 1930 1937 #endif … … 1997 2004 ENDIF 1998 2005 1999 CALL handle_netcdf_error( 'data_output_2d', 55 )2006 CALL netcdf_handle_error( 'data_output_2d', 55 ) 2000 2007 2001 2008 CASE ( 'xz' ) … … 2047 2054 ENDIF 2048 2055 2049 CALL handle_netcdf_error( 'data_output_2d', 57 )2056 CALL netcdf_handle_error( 'data_output_2d', 57 ) 2050 2057 2051 2058 CASE ( 'yz' ) … … 2097 2104 ENDIF 2098 2105 2099 CALL handle_netcdf_error( 'data_output_2d', 60 )2106 CALL netcdf_handle_error( 'data_output_2d', 60 ) 2100 2107 2101 2108 CASE DEFAULT -
palm/trunk/SOURCE/data_output_3d.f90
r1746 r1783 19 19 ! Current revisions: 20 20 ! ------------------ 21 ! 21 ! name change of netcdf routines and module + related changes 22 22 ! 23 23 ! Former revisions: … … 118 118 ONLY: avs_data_file, cloud_physics, do3d, do3d_avs_n, & 119 119 do3d_no, do3d_time_count, io_blocks, io_group, & 120 message_string, n etcdf_data_format, ntdim_3d,&120 message_string, ntdim_3d, & 121 121 nz_do3d, plot_3d_precision, psolver, simulated_time, & 122 122 simulated_time_chr, skip_do_avs, time_since_reference_point … … 134 134 ONLY: m_soil, m_soil_av, nzb_soil, nzt_soil, t_soil, t_soil_av 135 135 136 USE netcdf_control 136 #if defined( __netcdf ) 137 USE NETCDF 138 #endif 139 140 USE netcdf_interface, & 141 ONLY: id_set_3d, id_var_do3d, id_var_time_3d, nc_stat, & 142 netcdf_data_format, netcdf_handle_error 137 143 138 144 USE particle_attributes, & … … 228 234 start = (/ do3d_time_count(av) /), & 229 235 count = (/ 1 /) ) 230 CALL handle_netcdf_error( 'data_output_3d', 376 )236 CALL netcdf_handle_error( 'data_output_3d', 376 ) 231 237 ENDIF 232 238 #endif … … 688 694 count = (/ nxr-nxl+1, nyn-nys+1, nzt_do-nzb_do+1, 1 /) ) 689 695 ENDIF 690 CALL handle_netcdf_error( 'data_output_3d', 386 )696 CALL netcdf_handle_error( 'data_output_3d', 386 ) 691 697 #endif 692 698 ENDIF … … 697 703 start = (/ 1, 1, 1, do3d_time_count(av) /), & 698 704 count = (/ nx+2, ny+2, nzt_do-nzb_do+1, 1 /) ) 699 CALL handle_netcdf_error( 'data_output_3d', 446 )705 CALL netcdf_handle_error( 'data_output_3d', 446 ) 700 706 #endif 701 707 #endif -
palm/trunk/SOURCE/data_output_mask.f90
r1692 r1783 19 19 ! Current revisions: 20 20 ! ----------------- 21 ! 21 ! name change of netcdf routines and module + related changes, 22 ! switch back of netcdf data format moved from time integration routine to here 22 23 ! 23 24 ! Former revisions: … … 96 97 97 98 USE control_parameters, & 98 ONLY: cloud_physics, domask, domask_no, domask_time_count, & 99 mask_i, mask_j, mask_k, mask_size, mask_size_l, & 100 mask_start_l, max_masks, message_string, mid, & 101 netcdf_data_format, nz_do3d, simulated_time 99 ONLY: cloud_physics, domask, domask_no, domask_time_count, mask_i, & 100 mask_j, mask_k, mask_size, mask_size_l, mask_start_l, & 101 max_masks, message_string, mid, nz_do3d, simulated_time 102 102 USE cpulog, & 103 103 ONLY: cpu_log, log_point 104 104 105 106 107 105 USE indices, & 108 106 ONLY: nbgp, nxl, nxr, nyn, nys, nzb, nzt … … 110 108 USE kinds 111 109 112 USE netcdf 113 114 USE netcdf_control 110 USE NETCDF 111 112 USE netcdf_interface, & 113 ONLY: id_set_mask, id_var_domask, id_var_time_mask, nc_stat, & 114 netcdf_data_format, netcdf_handle_error 115 115 116 116 USE particle_attributes, & … … 136 136 INTEGER(iwp) :: k !< 137 137 INTEGER(iwp) :: n !< 138 INTEGER(iwp) :: netcdf_data_format_save !< 138 139 INTEGER(iwp) :: psi !< 139 140 INTEGER(iwp) :: sender !< … … 158 159 159 160 CALL cpu_log (log_point(49),'data_output_mask','start') 161 162 ! 163 !-- Parallel netcdf output is not tested so far for masked data, hence 164 !-- netcdf_data_format is switched back to non-paralell output. 165 netcdf_data_format_save = netcdf_data_format 166 IF ( netcdf_data_format == 5 ) netcdf_data_format = 3 167 IF ( netcdf_data_format == 6 ) netcdf_data_format = 4 160 168 161 169 ! … … 183 191 start = (/ domask_time_count(mid,av) /), & 184 192 count = (/ 1 /) ) 185 CALL handle_netcdf_error( 'data_output_mask', 460 )193 CALL netcdf_handle_error( 'data_output_mask', 460 ) 186 194 ENDIF 187 195 … … 564 572 count = (/ mask_size_l(mid,1), mask_size_l(mid,2), & 565 573 mask_size_l(mid,3), 1 /) ) 566 CALL handle_netcdf_error( 'data_output_mask', 461 )574 CALL netcdf_handle_error( 'data_output_mask', 461 ) 567 575 ELSE 568 576 #endif … … 611 619 count = (/ mask_size(mid,1), mask_size(mid,2), & 612 620 mask_size(mid,3), 1 /) ) 613 CALL handle_netcdf_error( 'data_output_mask', 462 )621 CALL netcdf_handle_error( 'data_output_mask', 462 ) 614 622 615 623 ELSE … … 656 664 count = (/ mask_size_l(mid,1), mask_size_l(mid,2), & 657 665 mask_size_l(mid,3), 1 /) ) 658 CALL handle_netcdf_error( 'data_output_mask', 463 )666 CALL netcdf_handle_error( 'data_output_mask', 463 ) 659 667 #endif 660 668 … … 672 680 #endif 673 681 682 ! 683 !-- Switch back to original format given by user (see beginning of this routine) 684 netcdf_data_format = netcdf_data_format_save 674 685 675 686 CALL cpu_log( log_point(49), 'data_output_mask', 'stop' ) -
palm/trunk/SOURCE/data_output_profiles.f90
r1683 r1783 19 19 ! Current revisions: 20 20 ! ----------------- 21 ! 21 ! name change of netcdf routines and module + related changes 22 22 ! 23 23 ! Former revisions: … … 86 86 USE kinds 87 87 88 USE netcdf_control 88 #if defined( __netcdf ) 89 USE NETCDF 90 #endif 91 92 USE netcdf_interface, & 93 ONLY: id_set_pr, id_var_dopr, id_var_norm_dopr, id_var_time_pr, & 94 nc_stat, netcdf_handle_error, output_for_t0 89 95 90 96 USE pegrid … … 155 161 (/ -coupling_start_time /), & 156 162 start = (/ 1 /), count = (/ 1 /) ) 157 CALL handle_netcdf_error( 'data_output_profiles', 329 )163 CALL netcdf_handle_error( 'data_output_profiles', 329 ) 158 164 output_for_t0 = .TRUE. 159 165 EXIT … … 166 172 (/ hom_sum(nzb,18,normalizing_region) /), & 167 173 start = (/ 1 /), count = (/ 1 /) ) 168 CALL handle_netcdf_error( 'data_output_profiles', 330 )174 CALL netcdf_handle_error( 'data_output_profiles', 330 ) 169 175 170 176 nc_stat = NF90_PUT_VAR( id_set_pr, id_var_norm_dopr(2), & ! ws2 171 177 (/ hom_sum(nzb+8,pr_palm,normalizing_region)**2 /), & 172 178 start = (/ 1 /), count = (/ 1 /) ) 173 CALL handle_netcdf_error( 'data_output_profiles', 331 )179 CALL netcdf_handle_error( 'data_output_profiles', 331 ) 174 180 nc_stat = NF90_PUT_VAR( id_set_pr, id_var_norm_dopr(3), & ! tsw2 175 181 (/ hom_sum(nzb+3,pr_palm,normalizing_region)**2 /), & 176 182 start = (/ 1 /), count = (/ 1 /) ) 177 CALL handle_netcdf_error( 'data_output_profiles', 332 )183 CALL netcdf_handle_error( 'data_output_profiles', 332 ) 178 184 nc_stat = NF90_PUT_VAR( id_set_pr, id_var_norm_dopr(4), & ! ws3 179 185 (/ hom_sum(nzb+8,pr_palm,normalizing_region)**3 /), & 180 186 start = (/ 1 /), count = (/ 1 /) ) 181 CALL handle_netcdf_error( 'data_output_profiles', 333 )187 CALL netcdf_handle_error( 'data_output_profiles', 333 ) 182 188 183 189 nc_stat = NF90_PUT_VAR( id_set_pr, id_var_norm_dopr(5), &!ws2tsw … … 185 191 hom_sum(nzb+3,pr_palm,normalizing_region) /), & 186 192 start = (/ 1 /), count = (/ 1 /) ) 187 CALL handle_netcdf_error( 'data_output_profiles', 334 )193 CALL netcdf_handle_error( 'data_output_profiles', 334 ) 188 194 189 195 nc_stat = NF90_PUT_VAR( id_set_pr, id_var_norm_dopr(6), &!wstsw2 … … 191 197 hom_sum(nzb+3,pr_palm,normalizing_region)**2 /), & 192 198 start = (/ 1 /), count = (/ 1 /) ) 193 CALL handle_netcdf_error( 'data_output_profiles', 335 )199 CALL netcdf_handle_error( 'data_output_profiles', 335 ) 194 200 195 201 nc_stat = NF90_PUT_VAR( id_set_pr, id_var_norm_dopr(7), & ! z_i 196 202 (/ hom_sum(nzb+6,pr_palm,normalizing_region) /), & 197 203 start = (/ 1 /), count = (/ 1 /) ) 198 CALL handle_netcdf_error( 'data_output_profiles', 336 )204 CALL netcdf_handle_error( 'data_output_profiles', 336 ) 199 205 200 206 #endif … … 216 222 start = (/ 1, 1 /), & 217 223 count = (/ nzt-nzb+2, 1 /) ) 218 CALL handle_netcdf_error( 'data_output_profiles', 337 )224 CALL netcdf_handle_error( 'data_output_profiles', 337 ) 219 225 #endif 220 226 … … 240 246 start = (/ dopr_time_count /), & 241 247 count = (/ 1 /) ) 242 CALL handle_netcdf_error( 'data_output_profiles', 338 )248 CALL netcdf_handle_error( 'data_output_profiles', 338 ) 243 249 244 250 ! … … 248 254 start = (/ dopr_time_count /), & 249 255 count = (/ 1 /) ) 250 CALL handle_netcdf_error( 'data_output_profiles', 339 )256 CALL netcdf_handle_error( 'data_output_profiles', 339 ) 251 257 252 258 nc_stat = NF90_PUT_VAR( id_set_pr, id_var_norm_dopr(2), & ! ws2 … … 254 260 start = (/ dopr_time_count /), & 255 261 count = (/ 1 /) ) 256 CALL handle_netcdf_error( 'data_output_profiles', 340 )262 CALL netcdf_handle_error( 'data_output_profiles', 340 ) 257 263 258 264 nc_stat = NF90_PUT_VAR( id_set_pr, id_var_norm_dopr(3), & ! tsw2 … … 260 266 start = (/ dopr_time_count /), & 261 267 count = (/ 1 /) ) 262 CALL handle_netcdf_error( 'data_output_profiles', 341 )268 CALL netcdf_handle_error( 'data_output_profiles', 341 ) 263 269 264 270 nc_stat = NF90_PUT_VAR( id_set_pr, id_var_norm_dopr(4), & ! ws3 … … 266 272 start = (/ dopr_time_count /), & 267 273 count = (/ 1 /) ) 268 CALL handle_netcdf_error( 'data_output_profiles', 342 )274 CALL netcdf_handle_error( 'data_output_profiles', 342 ) 269 275 270 276 nc_stat = NF90_PUT_VAR( id_set_pr, id_var_norm_dopr(5), & ! ws2tsw … … 273 279 start = (/ dopr_time_count /), & 274 280 count = (/ 1 /) ) 275 CALL handle_netcdf_error( 'data_output_profiles', 343 )281 CALL netcdf_handle_error( 'data_output_profiles', 343 ) 276 282 277 283 nc_stat = NF90_PUT_VAR( id_set_pr, id_var_norm_dopr(6), & ! wstsw2 … … 280 286 start = (/ dopr_time_count /), & 281 287 count = (/ 1 /) ) 282 CALL handle_netcdf_error( 'data_output_profiles', 344 )288 CALL netcdf_handle_error( 'data_output_profiles', 344 ) 283 289 284 290 nc_stat = NF90_PUT_VAR( id_set_pr, id_var_norm_dopr(7), & ! z_i … … 286 292 start = (/ dopr_time_count /), & 287 293 count = (/ 1 /) ) 288 CALL handle_netcdf_error( 'data_output_profiles', 345 )294 CALL netcdf_handle_error( 'data_output_profiles', 345 ) 289 295 #endif 290 296 … … 304 310 start = (/ 1, dopr_time_count /), & 305 311 count = (/ nzt-nzb+2, 1 /) ) 306 CALL handle_netcdf_error( 'data_output_profiles', 346 )312 CALL netcdf_handle_error( 'data_output_profiles', 346 ) 307 313 #endif 308 314 -
palm/trunk/SOURCE/data_output_ptseries.f90
r1683 r1783 19 19 ! Current revisions: 20 20 ! ----------------- 21 ! 21 ! netcdf module name changed + related changes 22 22 ! 23 23 ! Former revisions: … … 81 81 USE kinds 82 82 83 USE netcdf_control 83 #if defined( __netcdf ) 84 USE NETCDF 85 #endif 86 87 USE netcdf_interface, & 88 ONLY: dopts_num, id_set_pts, id_var_dopts, id_var_time_pts, nc_stat, & 89 netcdf_handle_error 84 90 85 91 USE particle_attributes, & … … 116 122 (/ time_since_reference_point /), & 117 123 start = (/ dopts_time_count /), count = (/ 1 /) ) 118 CALL handle_netcdf_error( 'data_output_ptseries', 391 )124 CALL netcdf_handle_error( 'data_output_ptseries', 391 ) 119 125 #endif 120 126 … … 375 381 start = (/ dopts_time_count /), & 376 382 count = (/ 1 /) ) 377 CALL handle_netcdf_error( 'data_output_ptseries', 392 )383 CALL netcdf_handle_error( 'data_output_ptseries', 392 ) 378 384 ENDDO 379 385 ENDDO -
palm/trunk/SOURCE/data_output_spectra.f90
r1683 r1783 19 19 ! Current revisions: 20 20 ! ------------------ 21 ! 21 ! name change of netcdf routines and module + related changes 22 22 ! 23 23 ! Former revisions: … … 69 69 SUBROUTINE data_output_spectra 70 70 71 #if defined( __netcdf ) 71 72 #if defined( __spectra ) 72 73 … … 81 82 USE kinds 82 83 83 USE netcdf_control 84 USE NETCDF 85 86 USE netcdf_interface, & 87 ONLY: id_set_sp, id_var_time_sp, nc_stat, netcdf_handle_error 84 88 85 89 USE pegrid … … 116 120 dosp_time_count = dosp_time_count + 1 117 121 118 #if defined( __netcdf )119 122 ! 120 123 !-- Update the spectra time axis … … 122 125 (/ time_since_reference_point /), & 123 126 start = (/ dosp_time_count /), count = (/ 1 /) ) 124 CALL handle_netcdf_error( 'data_output_spectra', 47 ) 125 #endif 127 CALL netcdf_handle_error( 'data_output_spectra', 47 ) 126 128 127 129 ! … … 201 203 202 204 #endif 205 #endif 203 206 END SUBROUTINE data_output_spectra 204 207 … … 226 229 USE kinds 227 230 228 USE netcdf_control 231 USE NETCDF 232 233 USE netcdf_interface, & 234 ONLY: id_set_sp, id_var_dospx, id_var_dospy, nc_stat, & 235 netcdf_handle_error 229 236 230 237 USE spectrum, & … … 261 268 start = (/ 1, k, dosp_time_count /), & 262 269 count = (/ nx/2, 1, 1 /) ) 263 CALL handle_netcdf_error( 'data_output_spectra', 348 )270 CALL netcdf_handle_error( 'data_output_spectra', 348 ) 264 271 265 272 ENDDO … … 279 286 start = (/ 1, k, dosp_time_count /), & 280 287 count = (/ ny/2, 1, 1 /) ) 281 CALL handle_netcdf_error( 'data_output_spectra', 349 )288 CALL netcdf_handle_error( 'data_output_spectra', 349 ) 282 289 283 290 ENDDO -
palm/trunk/SOURCE/data_output_tseries.f90
r1683 r1783 19 19 ! Current revisions: 20 20 ! ----------------- 21 ! 21 ! name change of netcdf routines and module + related changes 22 22 ! 23 23 ! Former revisions: … … 72 72 USE kinds 73 73 74 USE netcdf_control 74 #if defined( __netcdf ) 75 USE NETCDF 76 #endif 77 USE netcdf_interface, & 78 ONLY: dots_num, id_set_ts, id_var_dots, id_var_time_ts, nc_stat, & 79 netcdf_handle_error 75 80 76 81 USE pegrid … … 115 120 start = (/ dots_time_count /), & 116 121 count = (/ 1 /) ) 117 CALL handle_netcdf_error( 'data_output_tseries', 350 )122 CALL netcdf_handle_error( 'data_output_tseries', 350 ) 118 123 #endif 119 124 … … 129 134 start = (/ dots_time_count /), & 130 135 count = (/ 1 /) ) 131 CALL handle_netcdf_error( 'data_output_tseries', 351 )136 CALL netcdf_handle_error( 'data_output_tseries', 351 ) 132 137 ENDDO 133 138 #endif -
palm/trunk/SOURCE/flow_statistics.f90
r1748 r1783 19 19 ! Current revisions: 20 20 ! ----------------- 21 ! 21 ! +module netcdf_interface 22 22 ! 23 23 ! Former revisions: … … 207 207 208 208 USE land_surface_model_mod, & 209 ONLY: dots_soil, ghf_eb, land_surface, m_soil, nzb_soil, nzt_soil,&209 ONLY: ghf_eb, land_surface, m_soil, nzb_soil, nzt_soil, & 210 210 qsws_eb, qsws_liq_eb, qsws_soil_eb, qsws_veg_eb, r_a, r_s, & 211 211 shf_eb, t_soil 212 212 213 USE netcdf_interface, & 214 ONLY: dots_rad, dots_soil 215 213 216 USE pegrid 214 217 215 218 USE radiation_model_mod, & 216 ONLY: dots_rad, radiation, radiation_scheme, rad_net,&219 ONLY: radiation, radiation_scheme, rad_net, & 217 220 rad_lw_in, rad_lw_out, rad_lw_cs_hr, rad_lw_hr, & 218 221 rad_sw_in, rad_sw_out, rad_sw_cs_hr, rad_sw_hr -
palm/trunk/SOURCE/header.f90
r1765 r1783 19 19 ! Current revisions: 20 20 ! ----------------- 21 ! 21 ! netcdf module and variable names changed, output of netcdf_deflate 22 22 ! 23 23 ! Former revisions: … … 249 249 ONLY: damp_level_ind_1d, dt_pr_1d, dt_run_control_1d, end_time_1d 250 250 251 USE netcdf_interface, & 252 ONLY: netcdf_data_format, netcdf_data_format_string, netcdf_deflate 253 251 254 USE particle_attributes, & 252 255 ONLY: bc_par_b, bc_par_lr, bc_par_ns, bc_par_t, collision_kernel, & … … 1315 1318 1316 1319 output_format = '' 1317 output_format = output_format_netcdf 1318 WRITE ( io, 344 ) output_format 1320 output_format = netcdf_data_format_string 1321 IF ( netcdf_deflate == 0 ) THEN 1322 WRITE ( io, 344 ) output_format 1323 ELSE 1324 WRITE ( io, 354 ) TRIM( output_format ), netcdf_deflate 1325 ENDIF 1319 1326 1320 1327 DO i = 1, dopr_n … … 1379 1386 1380 1387 output_format = '' 1381 output_format = output_format_netcdf 1382 WRITE ( io, 344 ) output_format 1388 output_format = netcdf_data_format_string 1389 IF ( netcdf_deflate == 0 ) THEN 1390 WRITE ( io, 344 ) output_format 1391 ELSE 1392 WRITE ( io, 354 ) TRIM( output_format ), netcdf_deflate 1393 ENDIF 1383 1394 1384 1395 IF ( do2d_xy /= '' .AND. section(1,1) /= -9999 ) THEN … … 1536 1547 ENDIF 1537 1548 1538 output_format = output_format_netcdf 1539 WRITE ( io, 344 ) output_format 1549 output_format = netcdf_data_format_string 1550 IF ( netcdf_deflate == 0 ) THEN 1551 WRITE ( io, 344 ) output_format 1552 ELSE 1553 WRITE ( io, 354 ) TRIM( output_format ), netcdf_deflate 1554 ENDIF 1540 1555 1541 1556 IF ( do3d_at_begin ) THEN … … 1595 1610 ENDIF 1596 1611 1597 output_format = output_format_netcdf1612 output_format = netcdf_data_format_string 1598 1613 !-- Parallel output not implemented for mask data, hence 1599 1614 !-- output_format must be adjusted. 1600 1615 IF ( netcdf_data_format == 5 ) output_format = 'netCDF4/HDF5' 1601 1616 IF ( netcdf_data_format == 6 ) output_format = 'netCDF4/HDF5 classic' 1602 WRITE ( io, 344 ) output_format 1617 IF ( netcdf_deflate == 0 ) THEN 1618 WRITE ( io, 344 ) output_format 1619 ELSE 1620 WRITE ( io, 354 ) TRIM( output_format ), netcdf_deflate 1621 ENDIF 1603 1622 1604 1623 IF ( av == 0 ) THEN … … 1650 1669 WRITE ( io, 340 ) 1651 1670 1652 output_format = output_format_netcdf 1653 WRITE ( io, 344 ) output_format 1671 output_format = netcdf_data_format_string 1672 IF ( netcdf_deflate == 0 ) THEN 1673 WRITE ( io, 344 ) output_format 1674 ELSE 1675 WRITE ( io, 354 ) TRIM( output_format ), netcdf_deflate 1676 ENDIF 1654 1677 WRITE ( io, 341 ) dt_dots 1655 1678 ENDIF … … 1713 1736 WRITE ( io, 370 ) 1714 1737 1715 output_format = output_format_netcdf 1716 WRITE ( io, 344 ) output_format 1738 output_format = netcdf_data_format_string 1739 IF ( netcdf_deflate == 0 ) THEN 1740 WRITE ( io, 344 ) output_format 1741 ELSE 1742 WRITE ( io, 354 ) TRIM( output_format ), netcdf_deflate 1743 ENDIF 1717 1744 WRITE ( io, 371 ) dt_dosp 1718 1745 IF ( skip_time_dosp /= 0.0_wp ) WRITE ( io, 339 ) skip_time_dosp … … 1864 1891 output_format = 'netcdf and binary' 1865 1892 ENDIF 1866 WRITE ( io, 344 ) output_format 1893 IF ( netcdf_deflate == 0 ) THEN 1894 WRITE ( io, 344 ) output_format 1895 ELSE 1896 WRITE ( io, 354 ) TRIM( output_format ), netcdf_deflate 1897 ENDIF 1867 1898 ENDIF 1868 1899 IF ( dt_dopts /= 9999999.9_wp ) WRITE ( io, 494 ) dt_dopts … … 2176 2207 352 FORMAT (/' Number of output time levels allowed: ',I3 /) 2177 2208 353 FORMAT (/' Number of output time levels allowed: unlimited' /) 2209 354 FORMAT (' Output format: ',A, ' compressed with level: ',I1/) 2178 2210 #if defined( __dvrp_graphics ) 2179 2211 360 FORMAT (' Plot-Sequence with dvrp-software:'/ & -
palm/trunk/SOURCE/init_3d_model.f90
r1765 r1783 19 19 ! Current revisions: 20 20 ! ------------------ 21 ! 21 ! netcdf module name changed + related changes 22 22 ! 23 23 ! Former revisions: … … 262 262 ONLY: e1d, kh1d, km1d, l1d, rif1d, u1d, us1d, usws1d, v1d, vsws1d 263 263 264 USE netcdf_control 264 USE netcdf_interface, & 265 ONLY: dots_max, dots_num 265 266 266 267 USE particle_attributes, & -
palm/trunk/SOURCE/init_masks.f90
r1683 r1783 19 19 ! Current revisions: 20 20 ! ----------------- 21 ! 21 ! netcdf module name changed + related changes 22 22 ! 23 23 ! Former revisions: … … 96 96 mask_x_loop, mask_xyz_dimension, mask_y, mask_y_loop, mask_z, & 97 97 mask_z_loop, max_masks, message_string, mid, & 98 netcdf_data_format,passive_scalar, precipitation, ocean98 passive_scalar, precipitation, ocean 99 99 100 100 USE grid_variables, & … … 106 106 USE kinds 107 107 108 USE netcdf_control 108 USE netcdf_interface, & 109 ONLY: domask_unit, netcdf_data_format 109 110 110 111 USE particle_attributes, & -
palm/trunk/SOURCE/land_surface_model.f90
r1758 r1783 19 19 ! Current revisions: 20 20 ! ----------------- 21 ! 21 ! netcdf variables moved to netcdf module 22 22 ! 23 23 ! Former revisions: … … 132 132 USE kinds 133 133 134 USE netcdf_control, &135 ONLY: dots_label, dots_num, dots_unit136 137 134 USE pegrid 138 135 … … 157 154 nzt_soil = 3, & !< top of the soil model (to be switched) 158 155 nzs = 4 !< number of soil layers (fixed for now) 159 160 INTEGER(iwp) :: dots_soil = 0 !< starting index for timeseries output161 162 INTEGER(iwp), DIMENSION(0:1) :: id_dim_zs_xy, id_dim_zs_xz, id_dim_zs_yz, &163 id_dim_zs_3d, id_var_zs_xy, &164 id_var_zs_xz, id_var_zs_yz, id_var_zs_3d165 166 INTEGER(iwp), DIMENSION(1:max_masks,0:1) :: id_dim_zs_mask, id_var_zs_mask167 156 168 157 REAL(wp), PARAMETER :: & … … 519 508 520 509 ! 521 !-- Public grid and NetCDF variables 522 PUBLIC dots_soil, id_dim_zs_xy, id_dim_zs_xz, id_dim_zs_yz, & 523 id_dim_zs_3d, id_dim_zs_mask, id_var_zs_xy, id_var_zs_xz, & 524 id_var_zs_yz, id_var_zs_3d, id_var_zs_mask, nzb_soil, nzs, nzt_soil,& 525 zs 510 !-- Public grid variables 511 PUBLIC nzb_soil, nzs, nzt_soil, zs 526 512 527 513 ! … … 928 914 statistic_regions+1 ) 929 915 930 !931 !-- Add timeseries for land surface model932 dots_soil = dots_num + 1933 dots_num = dots_num + 8934 935 dots_label(dots_soil) = "ghf_eb"936 dots_label(dots_soil+1) = "shf_eb"937 dots_label(dots_soil+2) = "qsws_eb"938 dots_label(dots_soil+3) = "qsws_liq_eb"939 dots_label(dots_soil+4) = "qsws_soil_eb"940 dots_label(dots_soil+5) = "qsws_veg_eb"941 dots_label(dots_soil+6) = "r_a"942 dots_label(dots_soil+7) = "r_s"943 944 dots_unit(dots_soil:dots_soil+5) = "W/m2"945 dots_unit(dots_soil+6:dots_soil+7) = "s/m"946 947 948 916 END SUBROUTINE init_lsm 949 917 -
palm/trunk/SOURCE/lpm_data_output_particles.f90
r1683 r1783 19 19 ! Current revisions: 20 20 ! ------------------ 21 ! 21 ! name change of netcdf routines and module + related changes 22 22 ! 23 23 ! Former revisions: … … 65 65 USE kinds 66 66 67 USE netcdf_control 67 USE netcdf_interface, & 68 ONLY: nc_stat 68 69 69 70 USE particle_attributes, & … … 122 123 ! (/ simulated_time /), & 123 124 ! start = (/ prt_time_count /), count = (/ 1 /) ) 124 ! CALL handle_netcdf_error( 'lpm_data_output_particles', 1 )125 ! CALL netcdf_handle_error( 'lpm_data_output_particles', 1 ) 125 126 ! 126 127 ! ! … … 129 130 ! (/ number_of_particles /), & 130 131 ! start = (/ prt_time_count /), count = (/ 1 /) ) 131 ! CALL handle_netcdf_error( 'lpm_data_output_particles', 2 )132 ! CALL netcdf_handle_error( 'lpm_data_output_particles', 2 ) 132 133 ! 133 134 ! ! … … 136 137 ! start = (/ 1, prt_time_count /), & 137 138 ! count = (/ maximum_number_of_particles /) ) 138 ! CALL handle_netcdf_error( 'lpm_data_output_particles', 3 )139 ! CALL netcdf_handle_error( 'lpm_data_output_particles', 3 ) 139 140 ! 140 141 ! nc_stat = NF90_PUT_VAR( id_set_prt, id_var_prt(2), particles%dvrp_psize,& 141 142 ! start = (/ 1, prt_time_count /), & 142 143 ! count = (/ maximum_number_of_particles /) ) 143 ! CALL handle_netcdf_error( 'lpm_data_output_particles', 4 )144 ! CALL netcdf_handle_error( 'lpm_data_output_particles', 4 ) 144 145 ! 145 146 ! nc_stat = NF90_PUT_VAR( id_set_prt, id_var_prt(3), particles%origin_x, & 146 147 ! start = (/ 1, prt_time_count /), & 147 148 ! count = (/ maximum_number_of_particles /) ) 148 ! CALL handle_netcdf_error( 'lpm_data_output_particles', 5 )149 ! CALL netcdf_handle_error( 'lpm_data_output_particles', 5 ) 149 150 ! 150 151 ! nc_stat = NF90_PUT_VAR( id_set_prt, id_var_prt(4), particles%origin_y, & 151 152 ! start = (/ 1, prt_time_count /), & 152 153 ! count = (/ maximum_number_of_particles /) ) 153 ! CALL handle_netcdf_error( 'lpm_data_output_particles', 6 )154 ! CALL netcdf_handle_error( 'lpm_data_output_particles', 6 ) 154 155 ! 155 156 ! nc_stat = NF90_PUT_VAR( id_set_prt, id_var_prt(5), particles%origin_z, & 156 157 ! start = (/ 1, prt_time_count /), & 157 158 ! count = (/ maximum_number_of_particles /) ) 158 ! CALL handle_netcdf_error( 'lpm_data_output_particles', 7 )159 ! CALL netcdf_handle_error( 'lpm_data_output_particles', 7 ) 159 160 ! 160 161 ! nc_stat = NF90_PUT_VAR( id_set_prt, id_var_prt(6), particles%radius, & 161 162 ! start = (/ 1, prt_time_count /), & 162 163 ! count = (/ maximum_number_of_particles /) ) 163 ! CALL handle_netcdf_error( 'lpm_data_output_particles', 8 )164 ! CALL netcdf_handle_error( 'lpm_data_output_particles', 8 ) 164 165 ! 165 166 ! nc_stat = NF90_PUT_VAR( id_set_prt, id_var_prt(7), particles%speed_x, & 166 167 ! start = (/ 1, prt_time_count /), & 167 168 ! count = (/ maximum_number_of_particles /) ) 168 ! CALL handle_netcdf_error( 'lpm_data_output_particles', 9 )169 ! CALL netcdf_handle_error( 'lpm_data_output_particles', 9 ) 169 170 ! 170 171 ! nc_stat = NF90_PUT_VAR( id_set_prt, id_var_prt(8), particles%speed_y, & 171 172 ! start = (/ 1, prt_time_count /), & 172 173 ! count = (/ maximum_number_of_particles /) ) 173 ! CALL handle_netcdf_error( 'lpm_data_output_particles', 10 )174 ! CALL netcdf_handle_error( 'lpm_data_output_particles', 10 ) 174 175 ! 175 176 ! nc_stat = NF90_PUT_VAR( id_set_prt, id_var_prt(9), particles%speed_z, & 176 177 ! start = (/ 1, prt_time_count /), & 177 178 ! count = (/ maximum_number_of_particles /) ) 178 ! CALL handle_netcdf_error( 'lpm_data_output_particles', 11 )179 ! CALL netcdf_handle_error( 'lpm_data_output_particles', 11 ) 179 180 ! 180 181 ! nc_stat = NF90_PUT_VAR( id_set_prt,id_var_prt(10), & … … 182 183 ! start = (/ 1, prt_time_count /), & 183 184 ! count = (/ maximum_number_of_particles /) ) 184 ! CALL handle_netcdf_error( 'lpm_data_output_particles', 12 )185 ! CALL netcdf_handle_error( 'lpm_data_output_particles', 12 ) 185 186 ! 186 187 ! nc_stat = NF90_PUT_VAR( id_set_prt, id_var_prt(11), particles%x, & 187 188 ! start = (/ 1, prt_time_count /), & 188 189 ! count = (/ maximum_number_of_particles /) ) 189 ! CALL handle_netcdf_error( 'lpm_data_output_particles', 13 )190 ! CALL netcdf_handle_error( 'lpm_data_output_particles', 13 ) 190 191 ! 191 192 ! nc_stat = NF90_PUT_VAR( id_set_prt, id_var_prt(12), particles%y, & 192 193 ! start = (/ 1, prt_time_count /), & 193 194 ! count = (/ maximum_number_of_particles /) ) 194 ! CALL handle_netcdf_error( 'lpm_data_output_particles', 14 )195 ! CALL netcdf_handle_error( 'lpm_data_output_particles', 14 ) 195 196 ! 196 197 ! nc_stat = NF90_PUT_VAR( id_set_prt, id_var_prt(13), particles%z, & 197 198 ! start = (/ 1, prt_time_count /), & 198 199 ! count = (/ maximum_number_of_particles /) ) 199 ! CALL handle_netcdf_error( 'lpm_data_output_particles', 15 )200 ! CALL netcdf_handle_error( 'lpm_data_output_particles', 15 ) 200 201 ! 201 202 ! nc_stat = NF90_PUT_VAR( id_set_prt, id_var_prt(14), particles%class, & 202 203 ! start = (/ 1, prt_time_count /), & 203 204 ! count = (/ maximum_number_of_particles /) ) 204 ! CALL handle_netcdf_error( 'lpm_data_output_particles', 16 )205 ! CALL netcdf_handle_error( 'lpm_data_output_particles', 16 ) 205 206 ! 206 207 ! nc_stat = NF90_PUT_VAR( id_set_prt, id_var_prt(15), particles%group, & 207 208 ! start = (/ 1, prt_time_count /), & 208 209 ! count = (/ maximum_number_of_particles /) ) 209 ! CALL handle_netcdf_error( 'lpm_data_output_particles', 17 )210 ! CALL netcdf_handle_error( 'lpm_data_output_particles', 17 ) 210 211 ! 211 212 ! nc_stat = NF90_PUT_VAR( id_set_prt, id_var_prt(16), & … … 213 214 ! start = (/ 1, prt_time_count /), & 214 215 ! count = (/ maximum_number_of_particles /) ) 215 ! CALL handle_netcdf_error( 'lpm_data_output_particles', 18 )216 ! CALL netcdf_handle_error( 'lpm_data_output_particles', 18 ) 216 217 ! 217 218 ! nc_stat = NF90_PUT_VAR( id_set_prt, id_var_prt(17), particles%tail_id, & 218 219 ! start = (/ 1, prt_time_count /), & 219 220 ! count = (/ maximum_number_of_particles /) ) 220 ! CALL handle_netcdf_error( 'lpm_data_output_particles', 19 )221 ! CALL netcdf_handle_error( 'lpm_data_output_particles', 19 ) 221 222 ! 222 223 #endif -
palm/trunk/SOURCE/lpm_exchange_horiz.f90
r1692 r1783 19 19 ! Current revisions: 20 20 ! ------------------ 21 ! 21 ! new netcdf-module included 22 22 ! 23 23 ! Former revisions: … … 70 70 71 71 USE control_parameters, & 72 ONLY: dz, message_string, netcdf_data_format,simulated_time72 ONLY: dz, message_string, simulated_time 73 73 74 74 USE cpulog, & … … 85 85 USE lpm_pack_arrays_mod, & 86 86 ONLY: lpm_pack_arrays 87 88 USE netcdf_interface, & 89 ONLY: netcdf_data_format 87 90 88 91 USE particle_attributes, & -
palm/trunk/SOURCE/lpm_init.f90
r1726 r1783 19 19 ! Current revisions: 20 20 ! ----------------- 21 ! 21 ! netcdf module added 22 22 ! 23 23 ! Former revisions: … … 108 108 USE control_parameters, & 109 109 ONLY: cloud_droplets, constant_flux_layer, current_timestep_number, & 110 dz, initializing_actions, message_string, netcdf_data_format, & 111 ocean, simulated_time 110 dz, initializing_actions, message_string, ocean, simulated_time 112 111 113 112 USE dvrp_variables, & … … 125 124 USE lpm_collision_kernels_mod, & 126 125 ONLY: init_kernels 126 127 USE netcdf_interface, & 128 ONLY: netcdf_data_format 127 129 128 130 USE particle_attributes, & -
palm/trunk/SOURCE/lpm_release_set.f90
r1683 r1783 19 19 ! Current revisions: 20 20 ! ------------------ 21 ! 21 ! module control_parameters removed 22 22 ! 23 23 ! Former revisions: … … 58 58 SUBROUTINE lpm_release_set 59 59 60 61 USE control_parameters, &62 ONLY: iran, message_string, netcdf_data_format63 60 64 61 USE lpm_init_mod, & -
palm/trunk/SOURCE/modules.f90
r1780 r1783 19 19 ! Current revisions: 20 20 ! ------------------ 21 ! 21 ! netcdf variables moved to the netcdf-interface module 22 22 ! 23 23 ! Former revisions: … … 614 614 return_addres, return_username, & 615 615 timestep_scheme = 'runge-kutta-3' 616 CHARACTER (LEN=40) :: avs_data_file, output_format_netcdf, & 617 topography = 'flat' 616 CHARACTER (LEN=40) :: avs_data_file, topography = 'flat' 618 617 CHARACTER (LEN=64) :: host = ' ' 619 618 CHARACTER (LEN=80) :: log_message, run_identifier … … 629 628 CHARACTER (LEN=20), DIMENSION(300) :: data_output_pr = ' ' 630 629 CHARACTER (LEN=20), DIMENSION(200) :: data_output_pr_user = ' ' 631 CHARACTER (LEN=20), DIMENSION(11) :: netcdf_precision = ' '632 633 630 CHARACTER (LEN=20), DIMENSION(max_masks,0:1,100) :: domask = ' ' 634 631 CHARACTER (LEN=20), DIMENSION(0:1,100) :: do2d = ' ', do3d = ' ' … … 653 650 maximum_parallel_io_streams = -1, max_pr_user = 0, & 654 651 mgcycles = 0, mg_cycles = -1, mg_switch_to_pe0_level = 0, mid, & 655 nlsf = 1000, ntnudge = 1000, n etcdf_data_format = 2, ngsrb = 2, &652 nlsf = 1000, ntnudge = 1000, ngsrb = 2, & 656 653 nr_timesteps_this_run = 0, & 657 654 nsor = 20, nsor_ini = 100, n_sor, normalizing_region = 0, & … … 1153 1150 1154 1151 1155 !------------------------------------------------------------------------------!1156 ! Description:1157 ! ------------1158 !> Definition of parameters and variables for netcdf control.1159 !------------------------------------------------------------------------------!1160 MODULE netcdf_control1161 1162 USE control_parameters, ONLY: max_masks1163 USE kinds1164 #if defined( __netcdf )1165 USE netcdf1166 #endif1167 1168 INTEGER(iwp), PARAMETER :: dopr_norm_num = 7, dopts_num = 29, dots_max = 1001169 1170 INTEGER(iwp) :: dots_num = 231171 1172 CHARACTER (LEN=6), DIMENSION(dopr_norm_num) :: dopr_norm_names = &1173 (/ 'wpt0 ', 'ws2 ', 'tsw2 ', 'ws3 ', 'ws2tsw', 'wstsw2', &1174 'z_i ' /)1175 1176 CHARACTER (LEN=6), DIMENSION(dopr_norm_num) :: dopr_norm_longnames = &1177 (/ 'wpt0 ', 'w*2 ', 't*w2 ', 'w*3 ', 'w*2t*w', 'w*t*w2', &1178 'z_i ' /)1179 1180 CHARACTER (LEN=7), DIMENSION(dopts_num) :: dopts_label = &1181 (/ 'tnpt ', 'x_ ', 'y_ ', 'z_ ', 'z_abs ', 'u ', &1182 'v ', 'w ', 'u" ', 'v" ', 'w" ', 'npt_up ', &1183 'w_up ', 'w_down ', 'radius ', 'r_min ', 'r_max ', 'npt_max', &1184 'npt_min', 'x*2 ', 'y*2 ', 'z*2 ', 'u*2 ', 'v*2 ', &1185 'w*2 ', 'u"2 ', 'v"2 ', 'w"2 ', 'npt*2 ' /)1186 1187 CHARACTER (LEN=7), DIMENSION(dopts_num) :: dopts_unit = &1188 (/ 'number ', 'm ', 'm ', 'm ', 'm ', 'm/s ', &1189 'm/s ', 'm/s ', 'm/s ', 'm/s ', 'm/s ', 'number ', &1190 'm/s ', 'm/s ', 'm ', 'm ', 'm ', 'number ', &1191 'number ', 'm2 ', 'm2 ', 'm2 ', 'm2/s2 ', 'm2/s2 ', &1192 'm2/s2 ', 'm2/s2 ', 'm2/s2 ', 'm2/s2 ', 'number2' /)1193 1194 CHARACTER (LEN=13), DIMENSION(dots_max) :: dots_label = &1195 (/ 'E ', 'E* ', 'dt ', &1196 'u* ', 'th* ', 'umax ', &1197 'vmax ', 'wmax ', 'div_new ', &1198 'div_old ', 'z_i_wpt ', 'z_i_pt ', &1199 'w* ', 'w"pt"0 ', 'w"pt" ', &1200 'wpt ', 'pt(0) ', 'pt(z_mo) ', &1201 'w"u"0 ', 'w"v"0 ', 'w"q"0 ', &1202 'ol ', 'q* ', &1203 ( 'unknown ', i9 = 1, dots_max-23 ) /)1204 1205 CHARACTER (LEN=13), DIMENSION(dots_max) :: dots_unit = &1206 (/ 'm2/s2 ', 'm2/s2 ', 's ', &1207 'm/s ', 'K ', 'm/s ', &1208 'm/s ', 'm/s ', 's-1 ', &1209 's-1 ', 'm ', 'm ', &1210 'm/s ', 'K m/s ', 'K m/s ', &1211 'K m/s ', 'K ', 'K ', &1212 'm2/s2 ', 'm2/s2 ', 'kg m/s ', &1213 'm ', 'kg/kg ', &1214 ( 'unknown ', i9 = 1, dots_max-23 ) /)1215 1216 CHARACTER (LEN=9), DIMENSION(300) :: dopr_unit = 'unknown'1217 1218 CHARACTER (LEN=7), DIMENSION(0:1,100) :: do2d_unit, do3d_unit1219 1220 CHARACTER (LEN=16), DIMENSION(25) :: prt_var_names = &1221 (/ 'pt_age ', 'pt_dvrp_size ', 'pt_origin_x ', &1222 'pt_origin_y ', 'pt_origin_z ', 'pt_radius ', &1223 'pt_speed_x ', 'pt_speed_y ', 'pt_speed_z ', &1224 'pt_weight_factor', 'pt_x ', 'pt_y ', &1225 'pt_z ', 'pt_color ', 'pt_group ', &1226 'pt_tailpoints ', 'pt_tail_id ', 'pt_density_ratio', &1227 'pt_exp_arg ', 'pt_exp_term ', 'not_used ', &1228 'not_used ', 'not_used ', 'not_used ', &1229 'not_used ' /)1230 1231 CHARACTER (LEN=16), DIMENSION(25) :: prt_var_units = &1232 (/ 'seconds ', 'meters ', 'meters ', &1233 'meters ', 'meters ', 'meters ', &1234 'm/s ', 'm/s ', 'm/s ', &1235 'factor ', 'meters ', 'meters ', &1236 'meters ', 'none ', 'none ', &1237 'none ', 'none ', 'ratio ', &1238 'none ', 'none ', 'not_used ', &1239 'not_used ', 'not_used ', 'not_used ', &1240 'not_used ' /)1241 1242 INTEGER(iwp) :: id_dim_prtnum, id_dim_time_pr, id_dim_time_prt, &1243 id_dim_time_pts, id_dim_time_sp, id_dim_time_ts, id_dim_x_sp, &1244 id_dim_y_sp, id_dim_zu_sp, id_dim_zw_sp, id_set_pr, &1245 id_set_prt, id_set_pts, id_set_sp, id_set_ts, id_var_prtnum, &1246 id_var_rnop_prt, id_var_time_pr, id_var_time_prt, &1247 id_var_time_pts, id_var_time_sp, id_var_time_ts, id_var_x_sp, &1248 id_var_y_sp, id_var_zu_sp, id_var_zw_sp, nc_stat1249 1250 INTEGER(iwp), DIMENSION(0:1) :: id_dim_time_xy, id_dim_time_xz, &1251 id_dim_time_yz, id_dim_time_3d, id_dim_x_xy, id_dim_xu_xy, &1252 id_dim_x_xz, id_dim_xu_xz, id_dim_x_yz, id_dim_xu_yz, &1253 id_dim_x_3d, id_dim_xu_3d, id_dim_y_xy, id_dim_yv_xy, &1254 id_dim_y_xz, id_dim_yv_xz, id_dim_y_yz, id_dim_yv_yz, &1255 id_dim_y_3d, id_dim_yv_3d, id_dim_zu_xy, id_dim_zu1_xy, &1256 id_dim_zu_xz, id_dim_zu_yz, id_dim_zu_3d, id_dim_zw_xy, &1257 id_dim_zw_xz, id_dim_zw_yz, id_dim_zw_3d, id_set_xy, &1258 id_set_xz, id_set_yz, id_set_3d, id_var_ind_x_yz, &1259 id_var_ind_y_xz, id_var_ind_z_xy, id_var_time_xy, &1260 id_var_time_xz, id_var_time_yz, id_var_time_3d, id_var_x_xy, &1261 id_var_xu_xy, id_var_x_xz, id_var_xu_xz, id_var_x_yz, &1262 id_var_xu_yz, id_var_x_3d, id_var_xu_3d, id_var_y_xy, &1263 id_var_yv_xy, id_var_y_xz, id_var_yv_xz, id_var_y_yz, &1264 id_var_yv_yz, id_var_y_3d, id_var_yv_3d, id_var_zusi_xy, &1265 id_var_zusi_3d, id_var_zu_xy, id_var_zu1_xy, id_var_zu_xz, &1266 id_var_zu_yz, id_var_zu_3d, id_var_zwwi_xy, id_var_zwwi_3d, &1267 id_var_zw_xy, id_var_zw_xz, id_var_zw_yz, id_var_zw_3d1268 1269 INTEGER(iwp), DIMENSION(10) :: id_var_dospx, id_var_dospy1270 INTEGER(iwp), DIMENSION(20) :: id_var_prt1271 INTEGER(iwp), DIMENSION(11) :: nc_precision1272 INTEGER(iwp), DIMENSION(dopr_norm_num) :: id_var_norm_dopr1273 1274 INTEGER(iwp), DIMENSION(dopts_num,0:10) :: id_var_dopts1275 INTEGER(iwp), DIMENSION(0:1,100) :: id_var_do2d, id_var_do3d1276 INTEGER(iwp), DIMENSION(100,0:9) :: id_dim_z_pr, id_var_dopr, &1277 id_var_z_pr1278 INTEGER(iwp), DIMENSION(dots_max,0:9) :: id_var_dots1279 1280 !1281 !-- masked output1282 CHARACTER (LEN=7), DIMENSION(max_masks,0:1,100) :: domask_unit1283 1284 LOGICAL :: output_for_t0 = .FALSE.1285 1286 INTEGER(iwp), DIMENSION(1:max_masks,0:1) :: id_dim_time_mask, id_dim_x_mask, &1287 id_dim_xu_mask, id_dim_y_mask, id_dim_yv_mask, id_dim_zu_mask, &1288 id_dim_zw_mask, &1289 id_set_mask, &1290 id_var_time_mask, id_var_x_mask, id_var_xu_mask, &1291 id_var_y_mask, id_var_yv_mask, id_var_zu_mask, id_var_zw_mask, &1292 id_var_zusi_mask, id_var_zwwi_mask1293 1294 INTEGER(iwp), DIMENSION(1:max_masks,0:1,100) :: id_var_domask1295 1296 SAVE1297 1298 END MODULE netcdf_control1299 1152 1300 1153 -
palm/trunk/SOURCE/netcdf_interface.f90
r1782 r1783 1 !> @file netcdf .f901 !> @file netcdf_interface.f90 2 2 !--------------------------------------------------------------------------------! 3 3 ! This file is part of PALM. … … 19 19 ! Current revisions: 20 20 ! ------------------ 21 ! 21 ! netcdf interface has been modularized, former file netcdf renamed to 22 ! netcdf_interface, creation of netcdf-dimensions and -variables moved to 23 ! specific new subroutines create_netcdf_dim and create_netcdf_var, 24 ! compression (deflation) of variables implemented, 25 ! ibmy special cpp directive removed 22 26 ! 23 27 ! Former revisions: … … 120 124 !> cover every exception (change of dt_do, end_time in restart) 121 125 !------------------------------------------------------------------------------! 122 #if defined( __ibmy_special ) 123 @PROCESS NOOPTimize 126 MODULE netcdf_interface 127 128 USE control_parameters, ONLY: max_masks 129 USE kinds 130 #if defined( __netcdf ) 131 USE NETCDF 124 132 #endif 125 SUBROUTINE define_netcdf_header( callmode, extend, av ) 133 134 PRIVATE 135 136 INTEGER(iwp), PARAMETER :: dopr_norm_num = 7, dopts_num = 29, dots_max = 100 137 138 CHARACTER (LEN=6), DIMENSION(dopr_norm_num) :: dopr_norm_names = & 139 (/ 'wpt0 ', 'ws2 ', 'tsw2 ', 'ws3 ', 'ws2tsw', 'wstsw2', & 140 'z_i ' /) 141 142 CHARACTER (LEN=6), DIMENSION(dopr_norm_num) :: dopr_norm_longnames = & 143 (/ 'wpt0 ', 'w*2 ', 't*w2 ', 'w*3 ', 'w*2t*w', 'w*t*w2', & 144 'z_i ' /) 145 146 CHARACTER (LEN=7), DIMENSION(dopts_num) :: dopts_label = & 147 (/ 'tnpt ', 'x_ ', 'y_ ', 'z_ ', 'z_abs ', 'u ', & 148 'v ', 'w ', 'u" ', 'v" ', 'w" ', 'npt_up ', & 149 'w_up ', 'w_down ', 'radius ', 'r_min ', 'r_max ', 'npt_max', & 150 'npt_min', 'x*2 ', 'y*2 ', 'z*2 ', 'u*2 ', 'v*2 ', & 151 'w*2 ', 'u"2 ', 'v"2 ', 'w"2 ', 'npt*2 ' /) 152 153 CHARACTER (LEN=7), DIMENSION(dopts_num) :: dopts_unit = & 154 (/ 'number ', 'm ', 'm ', 'm ', 'm ', 'm/s ', & 155 'm/s ', 'm/s ', 'm/s ', 'm/s ', 'm/s ', 'number ', & 156 'm/s ', 'm/s ', 'm ', 'm ', 'm ', 'number ', & 157 'number ', 'm2 ', 'm2 ', 'm2 ', 'm2/s2 ', 'm2/s2 ', & 158 'm2/s2 ', 'm2/s2 ', 'm2/s2 ', 'm2/s2 ', 'number2' /) 159 160 INTEGER(iwp) :: dots_num = 31 !< number of timeseries defined by default 161 INTEGER(iwp) :: dots_soil = 24 !< starting index for soil-timeseries 162 INTEGER(iwp) :: dots_rad = 32 !< starting index for radiation-timeseries 163 164 CHARACTER (LEN=13), DIMENSION(dots_max) :: dots_label = & 165 (/ 'E ', 'E* ', 'dt ', & 166 'u* ', 'th* ', 'umax ', & 167 'vmax ', 'wmax ', 'div_new ', & 168 'div_old ', 'z_i_wpt ', 'z_i_pt ', & 169 'w* ', 'w"pt"0 ', 'w"pt" ', & 170 'wpt ', 'pt(0) ', 'pt(z_mo) ', & 171 'w"u"0 ', 'w"v"0 ', 'w"q"0 ', & 172 'ol ', 'q* ', 'ghf_eb ', & 173 'shf_eb ', 'qsws_eb ', 'qsws_liq_eb ', & 174 'qsws_soil_eb ', 'qsws_veg_eb ', 'r_a ', & 175 'r_s ', 'rad_net ', 'rad_lw_in ', & 176 'rad_lw_out ', 'rad_sw_in ', 'rad_sw_out ', & 177 'rrtm_aldif ', 'rrtm_aldir ', 'rrtm_asdif ', & 178 'rrtm_asdir ', & 179 ( 'unknown ', i9 = 1, dots_max-40 ) /) 180 181 CHARACTER (LEN=13), DIMENSION(dots_max) :: dots_unit = & 182 (/ 'm2/s2 ', 'm2/s2 ', 's ', & 183 'm/s ', 'K ', 'm/s ', & 184 'm/s ', 'm/s ', 's-1 ', & 185 's-1 ', 'm ', 'm ', & 186 'm/s ', 'K m/s ', 'K m/s ', & 187 'K m/s ', 'K ', 'K ', & 188 'm2/s2 ', 'm2/s2 ', 'kg m/s ', & 189 'm ', 'kg/kg ', ' ', & 190 ' ', ' ', ' ', & 191 ' ', 'W/m2 ', 's/m ', & 192 ' ', 'W/m2 ', 'W/m2 ', & 193 'W/m2 ', 'W/m2 ', 'W/m2 ', & 194 ' ', ' ', ' ', & 195 ' ', & 196 ( 'unknown ', i9 = 1, dots_max-40 ) /) 197 198 CHARACTER (LEN=9), DIMENSION(300) :: dopr_unit = 'unknown' 199 200 CHARACTER (LEN=7), DIMENSION(0:1,100) :: do2d_unit, do3d_unit 201 202 CHARACTER (LEN=16), DIMENSION(25) :: prt_var_names = & 203 (/ 'pt_age ', 'pt_dvrp_size ', 'pt_origin_x ', & 204 'pt_origin_y ', 'pt_origin_z ', 'pt_radius ', & 205 'pt_speed_x ', 'pt_speed_y ', 'pt_speed_z ', & 206 'pt_weight_factor', 'pt_x ', 'pt_y ', & 207 'pt_z ', 'pt_color ', 'pt_group ', & 208 'pt_tailpoints ', 'pt_tail_id ', 'pt_density_ratio', & 209 'pt_exp_arg ', 'pt_exp_term ', 'not_used ', & 210 'not_used ', 'not_used ', 'not_used ', & 211 'not_used ' /) 212 213 CHARACTER (LEN=16), DIMENSION(25) :: prt_var_units = & 214 (/ 'seconds ', 'meters ', 'meters ', & 215 'meters ', 'meters ', 'meters ', & 216 'm/s ', 'm/s ', 'm/s ', & 217 'factor ', 'meters ', 'meters ', & 218 'meters ', 'none ', 'none ', & 219 'none ', 'none ', 'ratio ', & 220 'none ', 'none ', 'not_used ', & 221 'not_used ', 'not_used ', 'not_used ', & 222 'not_used ' /) 223 224 CHARACTER(LEN=20), DIMENSION(11) :: netcdf_precision = ' ' 225 CHARACTER(LEN=40) :: netcdf_data_format_string 226 227 INTEGER(iwp) :: id_dim_prtnum, id_dim_time_pr, id_dim_time_prt, & 228 id_dim_time_pts, id_dim_time_sp, id_dim_time_ts, id_dim_x_sp, & 229 id_dim_y_sp, id_dim_zu_sp, id_dim_zw_sp, id_set_pr, & 230 id_set_prt, id_set_pts, id_set_sp, id_set_ts, id_var_prtnum, & 231 id_var_rnop_prt, id_var_time_pr, id_var_time_prt, & 232 id_var_time_pts, id_var_time_sp, id_var_time_ts, id_var_x_sp, & 233 id_var_y_sp, id_var_zu_sp, id_var_zw_sp, nc_stat 234 235 INTEGER(iwp), DIMENSION(0:1) :: id_dim_time_xy, id_dim_time_xz, & 236 id_dim_time_yz, id_dim_time_3d, id_dim_x_xy, id_dim_xu_xy, & 237 id_dim_x_xz, id_dim_xu_xz, id_dim_x_yz, id_dim_xu_yz, & 238 id_dim_x_3d, id_dim_xu_3d, id_dim_y_xy, id_dim_yv_xy, & 239 id_dim_y_xz, id_dim_yv_xz, id_dim_y_yz, id_dim_yv_yz, & 240 id_dim_y_3d, id_dim_yv_3d, id_dim_zs_xy, id_dim_zs_xz, & 241 id_dim_zs_yz, id_dim_zs_3d, id_dim_zu_xy, id_dim_zu1_xy, & 242 id_dim_zu_xz, id_dim_zu_yz, id_dim_zu_3d, id_dim_zw_xy, & 243 id_dim_zw_xz, id_dim_zw_yz, id_dim_zw_3d, id_set_xy, & 244 id_set_xz, id_set_yz, id_set_3d, id_var_ind_x_yz, & 245 id_var_ind_y_xz, id_var_ind_z_xy, id_var_time_xy, & 246 id_var_time_xz, id_var_time_yz, id_var_time_3d, id_var_x_xy, & 247 id_var_xu_xy, id_var_x_xz, id_var_xu_xz, id_var_x_yz, & 248 id_var_xu_yz, id_var_x_3d, id_var_xu_3d, id_var_y_xy, & 249 id_var_yv_xy, id_var_y_xz, id_var_yv_xz, id_var_y_yz, & 250 id_var_yv_yz, id_var_y_3d, id_var_yv_3d, id_var_zs_xy, & 251 id_var_zs_xz, id_var_zs_yz, id_var_zs_3d, id_var_zusi_xy, & 252 id_var_zusi_3d, id_var_zu_xy, id_var_zu1_xy, id_var_zu_xz, & 253 id_var_zu_yz, id_var_zu_3d, id_var_zwwi_xy, id_var_zwwi_3d, & 254 id_var_zw_xy, id_var_zw_xz, id_var_zw_yz, id_var_zw_3d 255 256 INTEGER :: netcdf_data_format = 2 !< NetCDF3 64bit offset format 257 INTEGER :: netcdf_deflate = 0 !< NetCDF compression, default: no 258 !< compression 259 260 INTEGER(iwp), DIMENSION(10) :: id_var_dospx, id_var_dospy 261 INTEGER(iwp), DIMENSION(20) :: id_var_prt 262 INTEGER(iwp), DIMENSION(11) :: nc_precision 263 INTEGER(iwp), DIMENSION(dopr_norm_num) :: id_var_norm_dopr 264 265 INTEGER(iwp), DIMENSION(dopts_num,0:10) :: id_var_dopts 266 INTEGER(iwp), DIMENSION(0:1,100) :: id_var_do2d, id_var_do3d 267 INTEGER(iwp), DIMENSION(100,0:9) :: id_dim_z_pr, id_var_dopr, & 268 id_var_z_pr 269 INTEGER(iwp), DIMENSION(dots_max,0:9) :: id_var_dots 270 271 ! 272 !-- Masked output 273 CHARACTER (LEN=7), DIMENSION(max_masks,0:1,100) :: domask_unit 274 275 LOGICAL :: output_for_t0 = .FALSE. 276 277 INTEGER(iwp), DIMENSION(1:max_masks,0:1) :: id_dim_time_mask, id_dim_x_mask, & 278 id_dim_xu_mask, id_dim_y_mask, id_dim_yv_mask, id_dim_zs_mask, & 279 id_dim_zu_mask, id_dim_zw_mask, & 280 id_set_mask, & 281 id_var_time_mask, id_var_x_mask, id_var_xu_mask, & 282 id_var_y_mask, id_var_yv_mask, id_var_zs_mask, & 283 id_var_zu_mask, id_var_zw_mask, & 284 id_var_zusi_mask, id_var_zwwi_mask 285 286 INTEGER(iwp), DIMENSION(1:max_masks,0:1,100) :: id_var_domask 287 288 289 PUBLIC domask_unit, dopr_unit, dopts_num, dots_label, dots_max, dots_num, & 290 dots_rad, dots_soil, dots_unit, do2d_unit, do3d_unit, id_set_mask, & 291 id_set_pr, id_set_prt, id_set_pts, id_set_sp, id_set_ts, & 292 id_set_xy, id_set_xz, id_set_yz, id_set_3d, id_var_domask, & 293 id_var_dopr, id_var_dopts, id_var_dospx, id_var_dospy, & 294 id_var_dots, id_var_do2d, id_var_do3d, id_var_norm_dopr, & 295 id_var_time_mask, id_var_time_pr, id_var_time_pts, id_var_time_ts, & 296 id_var_time_xy, id_var_time_xz, id_var_time_yz,id_var_time_3d, & 297 nc_stat, netcdf_data_format, netcdf_data_format_string, & 298 netcdf_deflate, netcdf_precision, output_for_t0 299 300 SAVE 301 302 INTERFACE netcdf_create_dim 303 MODULE PROCEDURE netcdf_create_dim 304 END INTERFACE netcdf_create_dim 305 306 INTERFACE netcdf_create_file 307 MODULE PROCEDURE netcdf_create_file 308 END INTERFACE netcdf_create_file 309 310 INTERFACE netcdf_create_var 311 MODULE PROCEDURE netcdf_create_var 312 END INTERFACE netcdf_create_var 313 314 INTERFACE netcdf_define_header 315 MODULE PROCEDURE netcdf_define_header 316 END INTERFACE netcdf_define_header 317 318 INTERFACE netcdf_handle_error 319 MODULE PROCEDURE netcdf_handle_error 320 END INTERFACE netcdf_handle_error 321 322 INTERFACE netcdf_open_write_file 323 MODULE PROCEDURE netcdf_open_write_file 324 END INTERFACE netcdf_open_write_file 325 326 PUBLIC netcdf_create_file, netcdf_define_header, netcdf_handle_error, & 327 netcdf_open_write_file 328 329 CONTAINS 330 331 SUBROUTINE netcdf_define_header( callmode, extend, av ) 126 332 127 333 #if defined( __netcdf ) … … 141 347 dt_do2d_yz, dt_do3d, mask_size, do2d_xy_time_count, & 142 348 do3d_time_count, domask_time_count, end_time, mask_i_global, & 143 mask_j_global, mask_k_global, message_string, mid, & 144 netcdf_data_format, netcdf_precision, ntdim_2d_xy, & 349 mask_j_global, mask_k_global, message_string, mid, ntdim_2d_xy, & 145 350 ntdim_2d_xz, ntdim_2d_yz, ntdim_3d, nz_do3d, prt_time_count, & 146 351 run_description_header, section, simulated_time, & … … 155 360 ONLY: nx, ny, nz ,nzb, nzt 156 361 157 USE netcdf_control158 159 362 USE kinds 160 363 161 364 USE land_surface_model_mod, & 162 ONLY: land_surface, nzb_soil, nzt_soil, id_dim_zs_xy, id_dim_zs_xz, & 163 id_dim_zs_yz, id_dim_zs_3d, id_dim_zs_mask, id_var_zs_xy, & 164 id_var_zs_xz, id_var_zs_yz ,id_var_zs_3d, id_var_zs_mask, & 165 nzs, zs 365 ONLY: land_surface, nzb_soil, nzt_soil, nzs, zs 166 366 167 367 USE pegrid … … 172 372 USE profil_parameter, & 173 373 ONLY: crmax, cross_profiles, dopr_index, profile_columns, profile_rows 174 175 USE radiation_model_mod, &176 ONLY: rad_lw_in, rad_lw_out, rad_lw_cs_hr, rad_lw_hr, &177 rad_sw_in, rad_sw_out, rad_sw_cs_hr, rad_sw_hr178 179 374 180 375 USE spectrum, & … … 250 445 251 446 ! 252 !-- Initializing actions (return to calling routine check_parameters afterwards)447 !-- Initializing actions 253 448 IF ( .NOT. init_netcdf ) THEN 254 449 ! … … 263 458 '"_"netcdf_precision(', i, ')="', & 264 459 TRIM( netcdf_precision(i) ),'"' 265 CALL message( ' define_netcdf_header', 'PA0241', 1, 2, 0, 6, 0 )460 CALL message( 'netcdf_define_header', 'PA0241', 2, 2, 0, 6, 0 ) 266 461 ENDIF 267 462 … … 277 472 'netcdf_precision(', i, ')="', & 278 473 TRIM( netcdf_precision(i) ),'"' 279 CALL message( ' define_netcdf_header', 'PA0242', 1, 2, 0, 6, 0 )474 CALL message( 'netcdf_define_header', 'PA0242', 1, 2, 0, 6, 0 ) 280 475 ENDIF 281 476 … … 308 503 'assignment: netcdf_precision(', i, ')="', & 309 504 TRIM( netcdf_precision(i) ),'"' 310 CALL message( ' define_netcdf_header', 'PA0243', 1, 2, 0, 6, 0 )505 CALL message( 'netcdf_define_header', 'PA0243', 1, 2, 0, 6, 0 ) 311 506 312 507 END SELECT … … 316 511 ENDDO 317 512 513 ! 514 !-- Check for allowed parameter range 515 IF ( netcdf_deflate < 0 .OR. netcdf_deflate > 9 ) THEN 516 WRITE ( message_string, '(A,I3,A)' ) 'netcdf_deflate out of ' // & 517 'range & given value: ', netcdf_deflate, & 518 ', allowed range: 0-9' 519 CALL message( 'netcdf_define_header', 'PA0355', 2, 2, 0, 6, 0 ) 520 ENDIF 521 ! 522 !-- Data compression does not work with parallel NetCDF/HDF5 523 IF ( netcdf_deflate > 0 .AND. netcdf_data_format /= 3 ) THEN 524 message_string = 'netcdf_deflate reset to 0' 525 CALL message( 'netcdf_define_header', 'PA0356', 0, 1, 0, 6, 0 ) 526 527 netcdf_deflate = 0 528 ENDIF 529 318 530 init_netcdf = .TRUE. 319 320 RETURN321 531 322 532 ENDIF … … 352 562 !-- Define some global attributes of the dataset 353 563 nc_stat = NF90_PUT_ATT( id_set_mask(mid,av), NF90_GLOBAL, & 354 'Conventions', 'COARDS' )355 CALL handle_netcdf_error( 'netcdf', 464 )564 'Conventions', 'COARDS' ) 565 CALL netcdf_handle_error( 'netcdf_define_header', 464 ) 356 566 357 567 IF ( av == 0 ) THEN … … 364 574 TRIM( run_description_header ) // & 365 575 TRIM( time_average_text ) ) 366 CALL handle_netcdf_error( 'netcdf', 465 )576 CALL netcdf_handle_error( 'netcdf_define_header', 465 ) 367 577 IF ( av == 1 ) THEN 368 578 WRITE ( time_average_text,'(F7.1,'' s avg'')' ) averaging_interval 369 579 nc_stat = NF90_PUT_ATT( id_set_mask(mid,av), NF90_GLOBAL, & 370 580 'time_avg', TRIM( time_average_text ) ) 371 CALL handle_netcdf_error( 'netcdf', 466 )581 CALL netcdf_handle_error( 'netcdf_define_header', 466 ) 372 582 ENDIF 373 583 374 584 ! 375 585 !-- Define time coordinate for volume data (unlimited dimension) 376 nc_stat = NF90_DEF_DIM( id_set_mask(mid,av), 'time', NF90_UNLIMITED, & 377 id_dim_time_mask(mid,av) ) 378 CALL handle_netcdf_error( 'netcdf', 467 ) 379 380 nc_stat = NF90_DEF_VAR( id_set_mask(mid,av), 'time', NF90_DOUBLE, & 381 id_dim_time_mask(mid,av), & 382 id_var_time_mask(mid,av) ) 383 CALL handle_netcdf_error( 'netcdf', 468 ) 384 385 nc_stat = NF90_PUT_ATT( id_set_mask(mid,av), & 386 id_var_time_mask(mid,av), 'units', & 387 'seconds') 388 CALL handle_netcdf_error( 'netcdf', 469 ) 389 586 CALL netcdf_create_dim( id_set_mask(mid,av), 'time', NF90_UNLIMITED, & 587 id_dim_time_mask(mid,av), 467 ) 588 CALL netcdf_create_var( id_set_mask(mid,av), & 589 (/ id_dim_time_mask(mid,av) /), 'time', & 590 NF90_DOUBLE, id_var_time_mask(mid,av), & 591 'seconds', '', 468, 469, 000 ) 390 592 ! 391 593 !-- Define spatial dimensions and coordinates: 392 594 !-- Define vertical coordinate grid (zu grid) 393 nc_stat = NF90_DEF_DIM( id_set_mask(mid,av), 'zu_3d', & 394 mask_size(mid,3), id_dim_zu_mask(mid,av) ) 395 CALL handle_netcdf_error( 'netcdf', 470 ) 396 397 nc_stat = NF90_DEF_VAR( id_set_mask(mid,av), 'zu_3d', NF90_DOUBLE, & 398 id_dim_zu_mask(mid,av), & 399 id_var_zu_mask(mid,av) ) 400 CALL handle_netcdf_error( 'netcdf', 471 ) 401 402 nc_stat = NF90_PUT_ATT( id_set_mask(mid,av), id_var_zu_mask(mid,av), & 403 'units', 'meters' ) 404 CALL handle_netcdf_error( 'netcdf', 472 ) 405 595 CALL netcdf_create_dim( id_set_mask(mid,av), 'zu_3d', & 596 mask_size(mid,3), id_dim_zu_mask(mid,av), & 597 470 ) 598 CALL netcdf_create_var( id_set_mask(mid,av), & 599 (/ id_dim_zu_mask(mid,av) /), 'zu_3d', & 600 NF90_DOUBLE, id_var_zu_mask(mid,av), & 601 'meters', '', 471, 472, 000 ) 406 602 ! 407 603 !-- Define vertical coordinate grid (zw grid) 408 nc_stat = NF90_DEF_DIM( id_set_mask(mid,av), 'zw_3d', & 409 mask_size(mid,3), id_dim_zw_mask(mid,av) ) 410 CALL handle_netcdf_error( 'netcdf', 473 ) 411 412 nc_stat = NF90_DEF_VAR( id_set_mask(mid,av), 'zw_3d', NF90_DOUBLE, & 413 id_dim_zw_mask(mid,av), & 414 id_var_zw_mask(mid,av) ) 415 CALL handle_netcdf_error( 'netcdf', 474 ) 416 417 nc_stat = NF90_PUT_ATT( id_set_mask(mid,av), id_var_zw_mask(mid,av), & 418 'units', 'meters' ) 419 CALL handle_netcdf_error( 'netcdf', 475 ) 420 604 CALL netcdf_create_dim( id_set_mask(mid,av), 'zw_3d', & 605 mask_size(mid,3), id_dim_zw_mask(mid,av), & 606 473 ) 607 CALL netcdf_create_var( id_set_mask(mid,av), & 608 (/ id_dim_zw_mask(mid,av) /), 'zw_3d', & 609 NF90_DOUBLE, id_var_zw_mask(mid,av), & 610 'meters', '', 474, 475, 000 ) 421 611 ! 422 612 !-- Define x-axis (for scalar position) 423 nc_stat = NF90_DEF_DIM( id_set_mask(mid,av), 'x', & 424 mask_size(mid,1), id_dim_x_mask(mid,av) ) 425 CALL handle_netcdf_error( 'netcdf', 476 ) 426 427 nc_stat = NF90_DEF_VAR( id_set_mask(mid,av), 'x', NF90_DOUBLE, & 428 id_dim_x_mask(mid,av), id_var_x_mask(mid,av) ) 429 CALL handle_netcdf_error( 'netcdf', 477 ) 430 431 nc_stat = NF90_PUT_ATT( id_set_mask(mid,av), id_var_x_mask(mid,av), & 432 'units', 'meters' ) 433 CALL handle_netcdf_error( 'netcdf', 478 ) 434 613 CALL netcdf_create_dim( id_set_mask(mid,av), 'x', mask_size(mid,1), & 614 id_dim_x_mask(mid,av), 476 ) 615 CALL netcdf_create_var( id_set_mask(mid,av), & 616 (/ id_dim_x_mask(mid,av) /), 'x', & 617 NF90_DOUBLE, id_var_x_mask(mid,av), & 618 'meters', '', 477, 478, 000 ) 435 619 ! 436 620 !-- Define x-axis (for u position) 437 nc_stat = NF90_DEF_DIM( id_set_mask(mid,av), 'xu', & 438 mask_size(mid,1), id_dim_xu_mask(mid,av) ) 439 CALL handle_netcdf_error( 'netcdf', 479 ) 440 441 nc_stat = NF90_DEF_VAR( id_set_mask(mid,av), 'xu', NF90_DOUBLE, & 442 id_dim_xu_mask(mid,av), & 443 id_var_xu_mask(mid,av) ) 444 CALL handle_netcdf_error( 'netcdf', 480 ) 445 446 nc_stat = NF90_PUT_ATT( id_set_mask(mid,av), id_var_xu_mask(mid,av), & 447 'units', 'meters' ) 448 CALL handle_netcdf_error( 'netcdf', 481 ) 449 621 CALL netcdf_create_dim( id_set_mask(mid,av), 'xu', mask_size(mid,1), & 622 id_dim_xu_mask(mid,av), 479 ) 623 CALL netcdf_create_var( id_set_mask(mid,av), & 624 (/ id_dim_xu_mask(mid,av) /), 'xu', & 625 NF90_DOUBLE, id_var_xu_mask(mid,av), & 626 'meters', '', 480, 481, 000 ) 450 627 ! 451 628 !-- Define y-axis (for scalar position) 452 nc_stat = NF90_DEF_DIM( id_set_mask(mid,av), 'y', & 453 mask_size(mid,2), id_dim_y_mask(mid,av) ) 454 CALL handle_netcdf_error( 'netcdf', 482 ) 455 456 nc_stat = NF90_DEF_VAR( id_set_mask(mid,av), 'y', NF90_DOUBLE, & 457 id_dim_y_mask(mid,av), id_var_y_mask(mid,av) ) 458 CALL handle_netcdf_error( 'netcdf', 483 ) 459 460 nc_stat = NF90_PUT_ATT( id_set_mask(mid,av), id_var_y_mask(mid,av), & 461 'units', 'meters' ) 462 CALL handle_netcdf_error( 'netcdf', 484 ) 463 629 CALL netcdf_create_dim( id_set_mask(mid,av), 'y', mask_size(mid,2), & 630 id_dim_y_mask(mid,av), 482 ) 631 CALL netcdf_create_var( id_set_mask(mid,av), & 632 (/ id_dim_y_mask(mid,av) /), 'y', & 633 NF90_DOUBLE, id_var_y_mask(mid,av), & 634 'meters', '', 483, 484, 000 ) 464 635 ! 465 636 !-- Define y-axis (for v position) 466 nc_stat = NF90_DEF_DIM( id_set_mask(mid,av), 'yv', & 467 mask_size(mid,2), id_dim_yv_mask(mid,av) ) 468 CALL handle_netcdf_error( 'netcdf', 485 ) 469 470 nc_stat = NF90_DEF_VAR( id_set_mask(mid,av), 'yv', NF90_DOUBLE, & 471 id_dim_yv_mask(mid,av), & 472 id_var_yv_mask(mid,av) ) 473 CALL handle_netcdf_error( 'netcdf', 486 ) 474 475 nc_stat = NF90_PUT_ATT( id_set_mask(mid,av), id_var_yv_mask(mid,av), & 476 'units', 'meters' ) 477 CALL handle_netcdf_error( 'netcdf', 487 ) 478 637 CALL netcdf_create_dim( id_set_mask(mid,av), 'yv', mask_size(mid,2), & 638 id_dim_yv_mask(mid,av), 485 ) 639 CALL netcdf_create_var( id_set_mask(mid,av), & 640 (/ id_dim_yv_mask(mid,av) /), & 641 'yv', NF90_DOUBLE, id_var_yv_mask(mid,av), & 642 'meters', '', 486, 487, 000 ) 479 643 ! 480 644 !-- In case of non-flat topography define 2d-arrays containing the height … … 483 647 ! 484 648 !-- Define zusi = zu(nzb_s_inner) 485 nc_stat = NF90_DEF_VAR( id_set_mask(mid,av), 'zusi', NF90_DOUBLE, & 486 (/ id_dim_x_mask(mid,av), & 487 id_dim_y_mask(mid,av) /), & 488 id_var_zusi_mask(mid,av) ) 489 CALL handle_netcdf_error( 'netcdf', 488 ) 490 491 nc_stat = NF90_PUT_ATT( id_set_mask(mid,av), & 492 id_var_zusi_mask(mid,av), & 493 'units', 'meters' ) 494 CALL handle_netcdf_error( 'netcdf', 489 ) 495 496 nc_stat = NF90_PUT_ATT( id_set_mask(mid,av), & 497 id_var_zusi_mask(mid,av), & 498 'long_name', 'zu(nzb_s_inner)' ) 499 CALL handle_netcdf_error( 'netcdf', 490 ) 500 649 CALL netcdf_create_var( id_set_mask(mid,av), & 650 (/ id_dim_x_mask(mid,av), & 651 id_dim_y_mask(mid,av) /), 'zusi', & 652 NF90_DOUBLE, id_var_zusi_mask(mid,av), & 653 'meters', 'zu(nzb_s_inner)', 488, 489, & 654 490 ) 501 655 ! 502 656 !-- Define zwwi = zw(nzb_w_inner) 503 nc_stat = NF90_DEF_VAR( id_set_mask(mid,av), 'zwwi', NF90_DOUBLE, & 504 (/ id_dim_x_mask(mid,av), & 505 id_dim_y_mask(mid,av) /), & 506 id_var_zwwi_mask(mid,av) ) 507 CALL handle_netcdf_error( 'netcdf', 491 ) 508 509 nc_stat = NF90_PUT_ATT( id_set_mask(mid,av), & 510 id_var_zwwi_mask(mid,av), & 511 'units', 'meters' ) 512 CALL handle_netcdf_error( 'netcdf', 492 ) 513 514 nc_stat = NF90_PUT_ATT( id_set_mask(mid,av), & 515 id_var_zwwi_mask(mid,av), & 516 'long_name', 'zw(nzb_w_inner)' ) 517 CALL handle_netcdf_error( 'netcdf', 493 ) 518 657 CALL netcdf_create_var( id_set_mask(mid,av), & 658 (/ id_dim_x_mask(mid,av), & 659 id_dim_y_mask(mid,av) /), 'zwwi', & 660 NF90_DOUBLE, id_var_zwwi_mask(mid,av), & 661 'meters', 'zw(nzb_w_inner)', 491, 492, & 662 493 ) 519 663 ENDIF 520 664 … … 522 666 ! 523 667 !-- Define vertical coordinate grid (zw grid) 524 nc_stat = NF90_DEF_DIM( id_set_mask(mid,av), 'zs_3d', & 525 mask_size(mid,3), id_dim_zs_mask(mid,av) ) 526 CALL handle_netcdf_error( 'netcdf', 536 ) 527 528 nc_stat = NF90_DEF_VAR( id_set_mask(mid,av), 'zs_3d', NF90_DOUBLE, & 529 id_dim_zs_mask(mid,av), & 530 id_var_zs_mask(mid,av) ) 531 CALL handle_netcdf_error( 'netcdf', 536 ) 532 533 nc_stat = NF90_PUT_ATT( id_set_mask(mid,av), id_var_zs_mask(mid,av), & 534 'units', 'meters' ) 535 CALL handle_netcdf_error( 'netcdf', 537 ) 536 668 CALL netcdf_create_dim( id_set_mask(mid,av), 'zs_3d', & 669 mask_size(mid,3), id_dim_zs_mask(mid,av), & 670 536 ) 671 CALL netcdf_create_var( id_set_mask(mid,av), & 672 (/ id_dim_zs_mask(mid,av) /), 'zs_3d', & 673 NF90_DOUBLE, id_var_zs_mask(mid,av), & 674 'meters', '', 537, 555, 000 ) 537 675 ENDIF 538 676 … … 591 729 ! 592 730 !-- Check for user-defined quantities 593 CALL user_define_netcdf_grid( domask(mid,av,i), found, &731 CALL user_define_netcdf_grid( domask(mid,av,i), found, & 594 732 grid_x, grid_y, grid_z ) 733 734 IF ( .NOT. found ) THEN 735 WRITE ( message_string, * ) 'no grid defined for', & 736 ' variable ', TRIM( domask(mid,av,i) ) 737 CALL message( 'define_netcdf_header', 'PA0244', 0, 1, 0, & 738 6, 0 ) 739 ENDIF 595 740 596 741 END SELECT … … 620 765 ! 621 766 !-- Define the grid 622 nc_stat = NF90_DEF_VAR( id_set_mask(mid,av), domask(mid,av,i), & 623 nc_precision(11), & 624 (/ id_x, id_y, id_z, & 625 id_dim_time_mask(mid,av) /), & 626 id_var_domask(mid,av,i) ) 627 628 IF ( .NOT. found ) THEN 629 WRITE ( message_string, * ) 'no grid defined for', & 630 ' variable ', TRIM( domask(mid,av,i) ) 631 CALL message( 'define_netcdf_header', 'PA0244', 0, 1, 0, 6, 0 ) 632 ENDIF 767 CALL netcdf_create_var( id_set_mask(mid,av), (/ id_x, id_y, id_z, & 768 id_dim_time_mask(mid,av) /), & 769 domask(mid,av,i), nc_precision(11), & 770 id_var_domask(mid,av,i), & 771 TRIM( domask_unit(mid,av,i) ), & 772 domask(mid,av,i), 494, 495, 496 ) 633 773 634 774 var_list = TRIM( var_list ) // TRIM( domask(mid,av,i) ) // ';' 635 636 CALL handle_netcdf_error( 'netcdf', 494 )637 !638 !-- Store the 'real' name of the variable (with *, for example)639 !-- in the long_name attribute. This is evaluated by Ferret,640 !-- for example.641 nc_stat = NF90_PUT_ATT( id_set_mask(mid,av), &642 id_var_domask(mid,av,i), &643 'long_name', domask(mid,av,i) )644 CALL handle_netcdf_error( 'netcdf', 495 )645 !646 !-- Define the variable's unit647 nc_stat = NF90_PUT_ATT( id_set_mask(mid,av), &648 id_var_domask(mid,av,i), &649 'units', TRIM( domask_unit(mid,av,i) ) )650 CALL handle_netcdf_error( 'netcdf', 496 )651 775 652 776 i = i + 1 … … 663 787 nc_stat = NF90_PUT_ATT( id_set_mask(mid,av), NF90_GLOBAL, & 664 788 'VAR_LIST', var_list ) 665 CALL handle_netcdf_error( 'netcdf', 497 )789 CALL netcdf_handle_error( 'netcdf_define_header', 497 ) 666 790 667 791 ! 668 792 !-- Leave netCDF define mode 669 793 nc_stat = NF90_ENDDEF( id_set_mask(mid,av) ) 670 CALL handle_netcdf_error( 'netcdf', 498 )794 CALL netcdf_handle_error( 'netcdf_define_header', 498 ) 671 795 672 796 ! … … 679 803 netcdf_data, start = (/ 1 /), & 680 804 count = (/ mask_size(mid,1) /) ) 681 CALL handle_netcdf_error( 'netcdf', 499 )805 CALL netcdf_handle_error( 'netcdf_define_header', 499 ) 682 806 683 807 netcdf_data = mask_i_global(mid,:mask_size(mid,1)) * dx … … 686 810 netcdf_data, start = (/ 1 /), & 687 811 count = (/ mask_size(mid,1) /) ) 688 CALL handle_netcdf_error( 'netcdf', 500 )812 CALL netcdf_handle_error( 'netcdf_define_header', 500 ) 689 813 690 814 DEALLOCATE( netcdf_data ) … … 699 823 netcdf_data, start = (/ 1 /), & 700 824 count = (/ mask_size(mid,2) /)) 701 CALL handle_netcdf_error( 'netcdf', 501 )825 CALL netcdf_handle_error( 'netcdf_define_header', 501 ) 702 826 703 827 netcdf_data = mask_j_global(mid,:mask_size(mid,2)) * dy … … 706 830 netcdf_data, start = (/ 1 /), & 707 831 count = (/ mask_size(mid,2) /)) 708 CALL handle_netcdf_error( 'netcdf', 502 )832 CALL netcdf_handle_error( 'netcdf_define_header', 502 ) 709 833 710 834 DEALLOCATE( netcdf_data ) … … 719 843 netcdf_data, start = (/ 1 /), & 720 844 count = (/ mask_size(mid,3) /) ) 721 CALL handle_netcdf_error( 'netcdf', 503 )845 CALL netcdf_handle_error( 'netcdf_define_header', 503 ) 722 846 723 847 netcdf_data = zw( mask_k_global(mid,:mask_size(mid,3)) ) … … 726 850 netcdf_data, start = (/ 1 /), & 727 851 count = (/ mask_size(mid,3) /) ) 728 CALL handle_netcdf_error( 'netcdf', 504 )852 CALL netcdf_handle_error( 'netcdf_define_header', 504 ) 729 853 730 854 DEALLOCATE( netcdf_data ) … … 744 868 count = (/ mask_size(mid,1), & 745 869 mask_size(mid,2) /) ) 746 CALL handle_netcdf_error( 'netcdf', 505 )870 CALL netcdf_handle_error( 'netcdf_define_header', 505 ) 747 871 748 872 netcdf_data_2d = zw_w_inner( mask_i_global(mid,:mask_size(mid,1)),& … … 755 879 count = (/ mask_size(mid,1), & 756 880 mask_size(mid,2) /) ) 757 CALL handle_netcdf_error( 'netcdf', 506 )881 CALL netcdf_handle_error( 'netcdf_define_header', 506 ) 758 882 759 883 DEALLOCATE( netcdf_data_2d ) … … 772 896 netcdf_data, start = (/ 1 /), & 773 897 count = (/ mask_size(mid,3) /) ) 774 CALL handle_netcdf_error( 'netcdf', 538 )898 CALL netcdf_handle_error( 'netcdf_define_header', 538 ) 775 899 776 900 DEALLOCATE( netcdf_data ) … … 804 928 nc_stat = NF90_GET_ATT( id_set_mask(mid,av), NF90_GLOBAL, 'VAR_LIST',& 805 929 var_list_old ) 806 CALL handle_netcdf_error( 'netcdf', 507 )930 CALL netcdf_handle_error( 'netcdf_define_header', 507 ) 807 931 808 932 var_list = ';' … … 833 957 nc_stat = NF90_INQ_VARID( id_set_mask(mid,av), 'zu_3d', & 834 958 id_var_zu_mask(mid,av) ) 835 CALL handle_netcdf_error( 'netcdf', 508 )959 CALL netcdf_handle_error( 'netcdf_define_header', 508 ) 836 960 837 961 nc_stat = NF90_INQUIRE_VARIABLE( id_set_mask(mid,av), & 838 962 id_var_zu_mask(mid,av), & 839 963 dimids = id_dim_zu_mask_old ) 840 CALL handle_netcdf_error( 'netcdf', 509 )964 CALL netcdf_handle_error( 'netcdf_define_header', 509 ) 841 965 id_dim_zu_mask(mid,av) = id_dim_zu_mask_old(1) 842 966 … … 844 968 id_dim_zu_mask(mid,av), & 845 969 len = nz_old ) 846 CALL handle_netcdf_error( 'netcdf', 510 )970 CALL netcdf_handle_error( 'netcdf_define_header', 510 ) 847 971 848 972 IF ( mask_size(mid,3) /= nz_old ) THEN … … 864 988 nc_stat = NF90_INQ_VARID( id_set_mask(mid,av), 'time', & 865 989 id_var_time_mask(mid,av) ) 866 CALL handle_netcdf_error( 'netcdf', 511 )990 CALL netcdf_handle_error( 'netcdf_define_header', 511 ) 867 991 868 992 nc_stat = NF90_INQUIRE_VARIABLE( id_set_mask(mid,av), & 869 993 id_var_time_mask(mid,av), & 870 994 dimids = id_dim_time_old ) 871 CALL handle_netcdf_error( 'netcdf', 512 )995 CALL netcdf_handle_error( 'netcdf_define_header', 512 ) 872 996 id_dim_time_mask(mid,av) = id_dim_time_old(1) 873 997 … … 875 999 id_dim_time_mask(mid,av), & 876 1000 len = domask_time_count(mid,av) ) 877 CALL handle_netcdf_error( 'netcdf', 513 )1001 CALL netcdf_handle_error( 'netcdf_define_header', 513 ) 878 1002 879 1003 nc_stat = NF90_GET_VAR( id_set_mask(mid,av), & … … 882 1006 start = (/ domask_time_count(mid,av) /), & 883 1007 count = (/ 1 /) ) 884 CALL handle_netcdf_error( 'netcdf', 514 )1008 CALL netcdf_handle_error( 'netcdf_define_header', 514 ) 885 1009 886 1010 IF ( last_time_coordinate(1) >= simulated_time ) THEN … … 904 1028 TRIM( domask(mid,av,i) ), & 905 1029 id_var_domask(mid,av,i) ) 906 CALL handle_netcdf_error( 'netcdf', 515 )1030 CALL netcdf_handle_error( 'netcdf_define_header', 515 ) 907 1031 i = i + 1 908 1032 ENDDO … … 922 1046 ENDIF 923 1047 nc_stat = NF90_REDEF( id_set_mask(mid,av) ) 924 CALL handle_netcdf_error( 'netcdf', 516 )1048 CALL netcdf_handle_error( 'netcdf_define_header', 516 ) 925 1049 nc_stat = NF90_PUT_ATT( id_set_mask(mid,av), NF90_GLOBAL, 'title', & 926 1050 TRIM( run_description_header ) // & 927 1051 TRIM( time_average_text ) ) 928 CALL handle_netcdf_error( 'netcdf', 517 )1052 CALL netcdf_handle_error( 'netcdf_define_header', 517 ) 929 1053 nc_stat = NF90_ENDDEF( id_set_mask(mid,av) ) 930 CALL handle_netcdf_error( 'netcdf', 518 )1054 CALL netcdf_handle_error( 'netcdf_define_header', 518 ) 931 1055 WRITE ( message_string, * ) 'netCDF file for ', TRIM( var ), & 932 1056 ' data for mask', mid, ' from previous run found.', & … … 944 1068 nc_stat = NF90_PUT_ATT( id_set_3d(av), NF90_GLOBAL, 'Conventions', & 945 1069 'COARDS' ) 946 CALL handle_netcdf_error( 'netcdf', 62 )1070 CALL netcdf_handle_error( 'netcdf_define_header', 62 ) 947 1071 948 1072 IF ( av == 0 ) THEN … … 955 1079 TRIM( run_description_header ) // & 956 1080 TRIM( time_average_text ) ) 957 CALL handle_netcdf_error( 'netcdf', 63 )1081 CALL netcdf_handle_error( 'netcdf_define_header', 63 ) 958 1082 IF ( av == 1 ) THEN 959 1083 WRITE ( time_average_text,'(F7.1,'' s avg'')' ) averaging_interval 960 1084 nc_stat = NF90_PUT_ATT( id_set_3d(av), NF90_GLOBAL, 'time_avg', & 961 1085 TRIM( time_average_text ) ) 962 CALL handle_netcdf_error( 'netcdf', 63 )1086 CALL netcdf_handle_error( 'netcdf_define_header', 63 ) 963 1087 ENDIF 964 1088 … … 968 1092 !-- the performance drops significantly. 969 1093 IF ( netcdf_data_format < 5 ) THEN 970 nc_stat = NF90_DEF_DIM( id_set_3d(av), 'time', NF90_UNLIMITED, & 971 id_dim_time_3d(av) ) 972 CALL handle_netcdf_error( 'netcdf', 64 ) 1094 CALL netcdf_create_dim( id_set_3d(av), 'time', NF90_UNLIMITED, & 1095 id_dim_time_3d(av), 64 ) 973 1096 ELSE 974 nc_stat = NF90_DEF_DIM( id_set_3d(av), 'time', ntdim_3d(av), & 975 id_dim_time_3d(av) ) 976 CALL handle_netcdf_error( 'netcdf', 523 ) 977 ENDIF 978 979 nc_stat = NF90_DEF_VAR( id_set_3d(av), 'time', NF90_DOUBLE, & 980 id_dim_time_3d(av), id_var_time_3d(av) ) 981 CALL handle_netcdf_error( 'netcdf', 65 ) 982 983 nc_stat = NF90_PUT_ATT( id_set_3d(av), id_var_time_3d(av), 'units', & 984 'seconds') 985 CALL handle_netcdf_error( 'netcdf', 66 ) 986 1097 CALL netcdf_create_dim( id_set_3d(av), 'time', ntdim_3d(av), & 1098 id_dim_time_3d(av), 523 ) 1099 ENDIF 1100 1101 CALL netcdf_create_var( id_set_3d(av), (/ id_dim_time_3d(av) /), & 1102 'time', NF90_DOUBLE, id_var_time_3d(av), & 1103 'seconds', '', 65, 66, 00 ) 987 1104 ! 988 1105 !-- Define spatial dimensions and coordinates: 989 1106 !-- Define vertical coordinate grid (zu grid) 990 nc_stat = NF90_DEF_DIM( id_set_3d(av), 'zu_3d', nz_do3d-nzb+1, & 991 id_dim_zu_3d(av) ) 992 CALL handle_netcdf_error( 'netcdf', 67 ) 993 994 nc_stat = NF90_DEF_VAR( id_set_3d(av), 'zu_3d', NF90_DOUBLE, & 995 id_dim_zu_3d(av), id_var_zu_3d(av) ) 996 CALL handle_netcdf_error( 'netcdf', 68 ) 997 998 nc_stat = NF90_PUT_ATT( id_set_3d(av), id_var_zu_3d(av), 'units', & 999 'meters' ) 1000 CALL handle_netcdf_error( 'netcdf', 69 ) 1001 1107 CALL netcdf_create_dim( id_set_3d(av), 'zu_3d', nz_do3d-nzb+1, & 1108 id_dim_zu_3d(av), 67 ) 1109 CALL netcdf_create_var( id_set_3d(av), (/ id_dim_zu_3d(av) /), & 1110 'zu_3d', NF90_DOUBLE, id_var_zu_3d(av), & 1111 'meters', '', 68, 69, 00 ) 1002 1112 ! 1003 1113 !-- Define vertical coordinate grid (zw grid) 1004 nc_stat = NF90_DEF_DIM( id_set_3d(av), 'zw_3d', nz_do3d-nzb+1, & 1005 id_dim_zw_3d(av) ) 1006 CALL handle_netcdf_error( 'netcdf', 70 ) 1007 1008 nc_stat = NF90_DEF_VAR( id_set_3d(av), 'zw_3d', NF90_DOUBLE, & 1009 id_dim_zw_3d(av), id_var_zw_3d(av) ) 1010 CALL handle_netcdf_error( 'netcdf', 71 ) 1011 1012 nc_stat = NF90_PUT_ATT( id_set_3d(av), id_var_zw_3d(av), 'units', & 1013 'meters' ) 1014 CALL handle_netcdf_error( 'netcdf', 72 ) 1015 1114 CALL netcdf_create_dim( id_set_3d(av), 'zw_3d', nz_do3d-nzb+1, & 1115 id_dim_zw_3d(av), 70 ) 1116 CALL netcdf_create_var( id_set_3d(av), (/ id_dim_zw_3d(av) /), & 1117 'zw_3d', NF90_DOUBLE, id_var_zw_3d(av), & 1118 'meters', '', 71, 72, 00 ) 1016 1119 ! 1017 1120 !-- Define x-axis (for scalar position) 1018 nc_stat = NF90_DEF_DIM( id_set_3d(av), 'x', nx+2, id_dim_x_3d(av) ) 1019 CALL handle_netcdf_error( 'netcdf', 73 ) 1020 1021 nc_stat = NF90_DEF_VAR( id_set_3d(av), 'x', NF90_DOUBLE, & 1022 id_dim_x_3d(av), id_var_x_3d(av) ) 1023 CALL handle_netcdf_error( 'netcdf', 74 ) 1024 1025 nc_stat = NF90_PUT_ATT( id_set_3d(av), id_var_x_3d(av), 'units', & 1026 'meters' ) 1027 CALL handle_netcdf_error( 'netcdf', 75 ) 1028 1121 CALL netcdf_create_dim( id_set_3d(av), 'x', nx+2, id_dim_x_3d(av), & 1122 73 ) 1123 CALL netcdf_create_var( id_set_3d(av), (/ id_dim_x_3d(av) /), 'x', & 1124 NF90_DOUBLE, id_var_x_3d(av), 'meters', '', & 1125 74, 75, 00 ) 1029 1126 ! 1030 1127 !-- Define x-axis (for u position) 1031 nc_stat = NF90_DEF_DIM( id_set_3d(av), 'xu', nx+2, id_dim_xu_3d(av) ) 1032 CALL handle_netcdf_error( 'netcdf', 358 ) 1033 1034 nc_stat = NF90_DEF_VAR( id_set_3d(av), 'xu', NF90_DOUBLE, & 1035 id_dim_xu_3d(av), id_var_xu_3d(av) ) 1036 CALL handle_netcdf_error( 'netcdf', 359 ) 1037 1038 nc_stat = NF90_PUT_ATT( id_set_3d(av), id_var_xu_3d(av), 'units', & 1039 'meters' ) 1040 CALL handle_netcdf_error( 'netcdf', 360 ) 1041 1128 CALL netcdf_create_dim( id_set_3d(av), 'xu', nx+2, id_dim_xu_3d(av), & 1129 358 ) 1130 CALL netcdf_create_var( id_set_3d(av), (/ id_dim_xu_3d(av) /), 'xu', & 1131 NF90_DOUBLE, id_var_xu_3d(av), 'meters', '', & 1132 359, 360, 000 ) 1042 1133 ! 1043 1134 !-- Define y-axis (for scalar position) 1044 nc_stat = NF90_DEF_DIM( id_set_3d(av), 'y', ny+2, id_dim_y_3d(av) ) 1045 CALL handle_netcdf_error( 'netcdf', 76 ) 1046 1047 nc_stat = NF90_DEF_VAR( id_set_3d(av), 'y', NF90_DOUBLE, & 1048 id_dim_y_3d(av), id_var_y_3d(av) ) 1049 CALL handle_netcdf_error( 'netcdf', 77 ) 1050 1051 nc_stat = NF90_PUT_ATT( id_set_3d(av), id_var_y_3d(av), 'units', & 1052 'meters' ) 1053 CALL handle_netcdf_error( 'netcdf', 78 ) 1054 1135 CALL netcdf_create_dim( id_set_3d(av), 'y', ny+2, id_dim_y_3d(av), & 1136 76 ) 1137 CALL netcdf_create_var( id_set_3d(av), (/ id_dim_y_3d(av) /), 'y', & 1138 NF90_DOUBLE, id_var_y_3d(av), 'meters', '', & 1139 77, 78, 00 ) 1055 1140 ! 1056 1141 !-- Define y-axis (for v position) 1057 nc_stat = NF90_DEF_DIM( id_set_3d(av), 'yv', ny+2, id_dim_yv_3d(av) ) 1058 CALL handle_netcdf_error( 'netcdf', 361 ) 1059 1060 nc_stat = NF90_DEF_VAR( id_set_3d(av), 'yv', NF90_DOUBLE, & 1061 id_dim_yv_3d(av), id_var_yv_3d(av) ) 1062 CALL handle_netcdf_error( 'netcdf', 362 ) 1063 1064 nc_stat = NF90_PUT_ATT( id_set_3d(av), id_var_yv_3d(av), 'units', & 1065 'meters' ) 1066 CALL handle_netcdf_error( 'netcdf', 363 ) 1067 1142 CALL netcdf_create_dim( id_set_3d(av), 'yv', ny+2, id_dim_yv_3d(av), & 1143 361 ) 1144 CALL netcdf_create_var( id_set_3d(av), (/ id_dim_yv_3d(av) /), 'yv', & 1145 NF90_DOUBLE, id_var_yv_3d(av), 'meters', '', & 1146 362, 363, 000 ) 1068 1147 ! 1069 1148 !-- In case of non-flat topography define 2d-arrays containing the height … … 1072 1151 ! 1073 1152 !-- Define zusi = zu(nzb_s_inner) 1074 nc_stat = NF90_DEF_VAR( id_set_3d(av), 'zusi', NF90_DOUBLE, & 1075 (/ id_dim_x_3d(av), id_dim_y_3d(av) /), & 1076 id_var_zusi_3d(av) ) 1077 CALL handle_netcdf_error( 'netcdf', 413 ) 1078 1079 nc_stat = NF90_PUT_ATT( id_set_3d(av), id_var_zusi_3d(av), & 1080 'units', 'meters' ) 1081 CALL handle_netcdf_error( 'netcdf', 414 ) 1082 1083 nc_stat = NF90_PUT_ATT( id_set_3d(av), id_var_zusi_3d(av), & 1084 'long_name', 'zu(nzb_s_inner)' ) 1085 CALL handle_netcdf_error( 'netcdf', 415 ) 1086 1153 CALL netcdf_create_var( id_set_3d(av), (/ id_dim_x_3d(av), & 1154 id_dim_y_3d(av) /), 'zusi', NF90_DOUBLE, & 1155 id_var_zusi_3d(av), 'meters', & 1156 'zu(nzb_s_inner)', 413, 414, 415 ) 1087 1157 ! 1088 1158 !-- Define zwwi = zw(nzb_w_inner) 1089 nc_stat = NF90_DEF_VAR( id_set_3d(av), 'zwwi', NF90_DOUBLE, & 1090 (/ id_dim_x_3d(av), id_dim_y_3d(av) /), & 1091 id_var_zwwi_3d(av) ) 1092 CALL handle_netcdf_error( 'netcdf', 416 ) 1093 1094 nc_stat = NF90_PUT_ATT( id_set_3d(av), id_var_zwwi_3d(av), & 1095 'units', 'meters' ) 1096 CALL handle_netcdf_error( 'netcdf', 417 ) 1097 1098 nc_stat = NF90_PUT_ATT( id_set_3d(av), id_var_zwwi_3d(av), & 1099 'long_name', 'zw(nzb_w_inner)' ) 1100 CALL handle_netcdf_error( 'netcdf', 418 ) 1159 CALL netcdf_create_var( id_set_3d(av), (/ id_dim_x_3d(av), & 1160 id_dim_y_3d(av) /), 'zwwi', NF90_DOUBLE, & 1161 id_var_zwwi_3d(av), 'meters', & 1162 'zw(nzb_w_inner)', 416, 417, 418 ) 1101 1163 1102 1164 ENDIF … … 1105 1167 ! 1106 1168 !-- Define vertical coordinate grid (zs grid) 1107 nc_stat = NF90_DEF_DIM( id_set_3d(av), 'zs_3d', nzt_soil-nzb_soil+1, & 1108 id_dim_zs_3d(av) ) 1109 CALL handle_netcdf_error( 'netcdf', 70 ) 1110 1111 nc_stat = NF90_DEF_VAR( id_set_3d(av), 'zs_3d', NF90_DOUBLE, & 1112 id_dim_zs_3d(av), id_var_zs_3d(av) ) 1113 CALL handle_netcdf_error( 'netcdf', 71 ) 1114 1115 nc_stat = NF90_PUT_ATT( id_set_3d(av), id_var_zs_3d(av), 'units', & 1116 'meters' ) 1117 CALL handle_netcdf_error( 'netcdf', 72 ) 1169 CALL netcdf_create_dim( id_set_3d(av), 'zs_3d', & 1170 nzt_soil-nzb_soil+1, id_dim_zs_3d(av), 70 ) 1171 CALL netcdf_create_var( id_set_3d(av), (/ id_dim_zs_3d(av) /), & 1172 'zs_3d', NF90_DOUBLE, id_var_zs_3d(av), & 1173 'meters', '', 71, 72, 00 ) 1118 1174 1119 1175 ENDIF … … 1175 1231 CALL user_define_netcdf_grid( do3d(av,i), found, grid_x, & 1176 1232 grid_y, grid_z ) 1233 1234 IF ( .NOT. found ) THEN 1235 WRITE ( message_string, * ) 'no grid defined for varia', & 1236 'ble ', TRIM( do3d(av,i) ) 1237 CALL message( 'define_netcdf_header', 'PA0244', 0, 1, 0, & 1238 6, 0 ) 1239 ENDIF 1177 1240 1178 1241 END SELECT … … 1202 1265 ! 1203 1266 !-- Define the grid 1204 nc_stat = NF90_DEF_VAR( id_set_3d(av), do3d(av,i), & 1205 nc_precision(4), & 1206 (/ id_x, id_y, id_z, id_dim_time_3d(av) /), & 1207 id_var_do3d(av,i) ) 1208 1209 IF ( .NOT. found ) THEN 1210 WRITE ( message_string, * ) 'no grid defined for', & 1211 ' variable ', TRIM( do3d(av,i) ) 1212 CALL message( 'define_netcdf_header', 'PA0244', 0, 1, 0, 6, 0 ) 1213 ENDIF 1214 1215 var_list = TRIM( var_list ) // TRIM( do3d(av,i) ) // ';' 1216 1217 CALL handle_netcdf_error( 'netcdf', 79 ) 1218 ! 1219 !-- Store the 'real' name of the variable (with *, for example) 1220 !-- in the long_name attribute. This is evaluated by Ferret, 1221 !-- for example. 1222 nc_stat = NF90_PUT_ATT( id_set_3d(av), id_var_do3d(av,i), & 1223 'long_name', do3d(av,i) ) 1224 CALL handle_netcdf_error( 'netcdf', 80 ) 1225 ! 1226 !-- Define the variable's unit 1227 nc_stat = NF90_PUT_ATT( id_set_3d(av), id_var_do3d(av,i), & 1228 'units', TRIM( do3d_unit(av,i) ) ) 1229 CALL handle_netcdf_error( 'netcdf', 357 ) 1267 CALL netcdf_create_var( id_set_3d(av),(/ id_x, id_y, id_z, & 1268 id_dim_time_3d(av) /), do3d(av,i), & 1269 nc_precision(4), id_var_do3d(av,i), & 1270 TRIM( do3d_unit(av,i) ), do3d(av,i), 79, & 1271 80, 357 ) 1230 1272 #if defined( __netcdf4_parallel ) 1231 1273 IF ( netcdf_data_format > 4 ) THEN … … 1235 1277 id_var_do3d(av,i), & 1236 1278 1, 0 ) 1237 CALL handle_netcdf_error( 'netcdf', 532 )1279 CALL netcdf_handle_error( 'netcdf_define_header', 532 ) 1238 1280 ! 1239 1281 !-- Set collective io operations for parallel io … … 1241 1283 id_var_do3d(av,i), & 1242 1284 NF90_COLLECTIVE ) 1243 CALL handle_netcdf_error( 'netcdf', 445 )1285 CALL netcdf_handle_error( 'netcdf_define_header', 445 ) 1244 1286 ENDIF 1245 1287 #endif 1288 var_list = TRIM( var_list ) // TRIM( do3d(av,i) ) // ';' 1289 1246 1290 i = i + 1 1247 1291 … … 1257 1301 nc_stat = NF90_PUT_ATT( id_set_3d(av), NF90_GLOBAL, 'VAR_LIST', & 1258 1302 var_list ) 1259 CALL handle_netcdf_error( 'netcdf', 81 )1303 CALL netcdf_handle_error( 'netcdf_define_header', 81 ) 1260 1304 1261 1305 ! … … 1263 1307 !-- parallel output. 1264 1308 nc_stat = NF90_SET_FILL( id_set_3d(av), NF90_NOFILL, oldmode ) 1265 CALL handle_netcdf_error( 'netcdf', 528 )1309 CALL netcdf_handle_error( 'netcdf_define_header', 528 ) 1266 1310 1267 1311 ! 1268 1312 !-- Leave netCDF define mode 1269 1313 nc_stat = NF90_ENDDEF( id_set_3d(av) ) 1270 CALL handle_netcdf_error( 'netcdf', 82 )1314 CALL netcdf_handle_error( 'netcdf_define_header', 82 ) 1271 1315 1272 1316 ! … … 1285 1329 netcdf_data, start = (/ 1 /), & 1286 1330 count = (/ nx+2 /) ) 1287 CALL handle_netcdf_error( 'netcdf', 83 )1331 CALL netcdf_handle_error( 'netcdf_define_header', 83 ) 1288 1332 1289 1333 DO i = 0, nx+1 … … 1294 1338 netcdf_data, start = (/ 1 /), & 1295 1339 count = (/ nx+2 /) ) 1296 CALL handle_netcdf_error( 'netcdf', 385 )1340 CALL netcdf_handle_error( 'netcdf_define_header', 385 ) 1297 1341 1298 1342 DEALLOCATE( netcdf_data ) … … 1309 1353 netcdf_data, start = (/ 1 /), & 1310 1354 count = (/ ny+2 /) ) 1311 CALL handle_netcdf_error( 'netcdf', 84 )1355 CALL netcdf_handle_error( 'netcdf_define_header', 84 ) 1312 1356 1313 1357 DO i = 0, ny+1 … … 1318 1362 netcdf_data, start = (/ 1 /), & 1319 1363 count = (/ ny+2 /)) 1320 CALL handle_netcdf_error( 'netcdf', 387 )1364 CALL netcdf_handle_error( 'netcdf_define_header', 387 ) 1321 1365 1322 1366 DEALLOCATE( netcdf_data ) … … 1327 1371 zu(nzb:nz_do3d), start = (/ 1 /), & 1328 1372 count = (/ nz_do3d-nzb+1 /) ) 1329 CALL handle_netcdf_error( 'netcdf', 85 )1373 CALL netcdf_handle_error( 'netcdf_define_header', 85 ) 1330 1374 1331 1375 … … 1333 1377 zw(nzb:nz_do3d), start = (/ 1 /), & 1334 1378 count = (/ nz_do3d-nzb+1 /) ) 1335 CALL handle_netcdf_error( 'netcdf', 86 )1379 CALL netcdf_handle_error( 'netcdf_define_header', 86 ) 1336 1380 1337 1381 ! … … 1343 1387 start = (/ 1, 1 /), & 1344 1388 count = (/ nx+2, ny+2 /) ) 1345 CALL handle_netcdf_error( 'netcdf', 419 )1389 CALL netcdf_handle_error( 'netcdf_define_header', 419 ) 1346 1390 1347 1391 nc_stat = NF90_PUT_VAR( id_set_3d(av), id_var_zwwi_3d(av), & … … 1349 1393 start = (/ 1, 1 /), & 1350 1394 count = (/ nx+2, ny+2 /) ) 1351 CALL handle_netcdf_error( 'netcdf', 420 )1395 CALL netcdf_handle_error( 'netcdf_define_header', 420 ) 1352 1396 1353 1397 ENDIF … … 1359 1403 - zs(nzb_soil:nzt_soil), start = (/ 1 /), & 1360 1404 count = (/ nzt_soil-nzb_soil+1 /) ) 1361 CALL handle_netcdf_error( 'netcdf', 86 )1405 CALL netcdf_handle_error( 'netcdf_define_header', 86 ) 1362 1406 ENDIF 1363 1407 … … 1373 1417 nc_stat = NF90_GET_ATT( id_set_3d(av), NF90_GLOBAL, 'VAR_LIST', & 1374 1418 var_list_old ) 1375 CALL handle_netcdf_error( 'netcdf', 87 )1419 CALL netcdf_handle_error( 'netcdf_define_header', 87 ) 1376 1420 1377 1421 var_list = ';' … … 1402 1446 !-- Get and compare the number of vertical gridpoints 1403 1447 nc_stat = NF90_INQ_VARID( id_set_3d(av), 'zu_3d', id_var_zu_3d(av) ) 1404 CALL handle_netcdf_error( 'netcdf', 88 )1448 CALL netcdf_handle_error( 'netcdf_define_header', 88 ) 1405 1449 1406 1450 nc_stat = NF90_INQUIRE_VARIABLE( id_set_3d(av), id_var_zu_3d(av), & 1407 1451 dimids = id_dim_zu_3d_old ) 1408 CALL handle_netcdf_error( 'netcdf', 89 )1452 CALL netcdf_handle_error( 'netcdf_define_header', 89 ) 1409 1453 id_dim_zu_3d(av) = id_dim_zu_3d_old(1) 1410 1454 1411 1455 nc_stat = NF90_INQUIRE_DIMENSION( id_set_3d(av), id_dim_zu_3d(av), & 1412 1456 len = nz_old ) 1413 CALL handle_netcdf_error( 'netcdf', 90 )1457 CALL netcdf_handle_error( 'netcdf_define_header', 90 ) 1414 1458 1415 1459 IF ( nz_do3d-nzb+1 /= nz_old ) THEN … … 1431 1475 !-- on the file. 1432 1476 nc_stat = NF90_INQ_VARID( id_set_3d(av), 'time', id_var_time_3d(av) ) 1433 CALL handle_netcdf_error( 'netcdf', 91 )1477 CALL netcdf_handle_error( 'netcdf_define_header', 91 ) 1434 1478 1435 1479 nc_stat = NF90_INQUIRE_VARIABLE( id_set_3d(av), id_var_time_3d(av), & 1436 1480 dimids = id_dim_time_old ) 1437 CALL handle_netcdf_error( 'netcdf', 92 )1481 CALL netcdf_handle_error( 'netcdf_define_header', 92 ) 1438 1482 1439 1483 id_dim_time_3d(av) = id_dim_time_old(1) … … 1441 1485 nc_stat = NF90_INQUIRE_DIMENSION( id_set_3d(av), id_dim_time_3d(av), & 1442 1486 len = ntime_count ) 1443 CALL handle_netcdf_error( 'netcdf', 93 )1487 CALL netcdf_handle_error( 'netcdf_define_header', 93 ) 1444 1488 1445 1489 ! … … 1454 1498 start = (/ do3d_time_count(av) /), & 1455 1499 count = (/ 1 /) ) 1456 CALL handle_netcdf_error( 'netcdf', 94 )1500 CALL netcdf_handle_error( 'netcdf_define_header', 94 ) 1457 1501 1458 1502 IF ( last_time_coordinate(1) >= simulated_time ) THEN … … 1524 1568 nc_stat = NF90_INQ_VARID( id_set_3d(av), TRIM( do3d(av,i) ), & 1525 1569 id_var_do3d(av,i) ) 1526 CALL handle_netcdf_error( 'netcdf', 95 )1570 CALL netcdf_handle_error( 'netcdf_define_header', 95 ) 1527 1571 #if defined( __netcdf4_parallel ) 1528 1572 ! … … 1532 1576 id_var_do3d(av,i), & 1533 1577 NF90_COLLECTIVE ) 1534 CALL handle_netcdf_error( 'netcdf', 453 )1578 CALL netcdf_handle_error( 'netcdf_define_header', 453 ) 1535 1579 ENDIF 1536 1580 #endif … … 1552 1596 ENDIF 1553 1597 nc_stat = NF90_REDEF( id_set_3d(av) ) 1554 CALL handle_netcdf_error( 'netcdf', 429 )1598 CALL netcdf_handle_error( 'netcdf_define_header', 429 ) 1555 1599 nc_stat = NF90_PUT_ATT( id_set_3d(av), NF90_GLOBAL, 'title', & 1556 1600 TRIM( run_description_header ) // & 1557 1601 TRIM( time_average_text ) ) 1558 CALL handle_netcdf_error( 'netcdf', 96 )1602 CALL netcdf_handle_error( 'netcdf_define_header', 96 ) 1559 1603 nc_stat = NF90_ENDDEF( id_set_3d(av) ) 1560 CALL handle_netcdf_error( 'netcdf', 430 )1604 CALL netcdf_handle_error( 'netcdf_define_header', 430 ) 1561 1605 message_string = 'netCDF file for volume data ' // & 1562 1606 TRIM( var ) // ' from previous run found.' // & … … 1570 1614 nc_stat = NF90_PUT_ATT( id_set_xy(av), NF90_GLOBAL, 'Conventions', & 1571 1615 'COARDS' ) 1572 CALL handle_netcdf_error( 'netcdf', 97 )1616 CALL netcdf_handle_error( 'netcdf_define_header', 97 ) 1573 1617 1574 1618 IF ( av == 0 ) THEN … … 1581 1625 TRIM( run_description_header ) // & 1582 1626 TRIM( time_average_text ) ) 1583 CALL handle_netcdf_error( 'netcdf', 98 )1627 CALL netcdf_handle_error( 'netcdf_define_header', 98 ) 1584 1628 IF ( av == 1 ) THEN 1585 1629 WRITE ( time_average_text,'(F7.1,'' s avg'')' ) averaging_interval 1586 1630 nc_stat = NF90_PUT_ATT( id_set_xy(av), NF90_GLOBAL, 'time_avg', & 1587 1631 TRIM( time_average_text ) ) 1588 CALL handle_netcdf_error( 'netcdf', 98 )1632 CALL netcdf_handle_error( 'netcdf_define_header', 98 ) 1589 1633 ENDIF 1590 1634 … … 1594 1638 !-- the performance drops significantly. 1595 1639 IF ( netcdf_data_format < 5 ) THEN 1596 nc_stat = NF90_DEF_DIM( id_set_xy(av), 'time', NF90_UNLIMITED, & 1597 id_dim_time_xy(av) ) 1598 CALL handle_netcdf_error( 'netcdf', 99 ) 1640 CALL netcdf_create_dim( id_set_xy(av), 'time', NF90_UNLIMITED, & 1641 id_dim_time_xy(av), 99 ) 1599 1642 ELSE 1600 nc_stat = NF90_DEF_DIM( id_set_xy(av), 'time', ntdim_2d_xy(av), & 1601 id_dim_time_xy(av) ) 1602 CALL handle_netcdf_error( 'netcdf', 524 ) 1603 ENDIF 1604 1605 nc_stat = NF90_DEF_VAR( id_set_xy(av), 'time', NF90_DOUBLE, & 1606 id_dim_time_xy(av), id_var_time_xy(av) ) 1607 CALL handle_netcdf_error( 'netcdf', 100 ) 1608 1609 nc_stat = NF90_PUT_ATT( id_set_xy(av), id_var_time_xy(av), 'units', & 1610 'seconds') 1611 CALL handle_netcdf_error( 'netcdf', 101 ) 1612 1643 CALL netcdf_create_dim( id_set_xy(av), 'time', ntdim_2d_xy(av), & 1644 id_dim_time_xy(av), 524 ) 1645 ENDIF 1646 1647 CALL netcdf_create_var( id_set_xy(av), (/ id_dim_time_xy(av) /), & 1648 'time', NF90_DOUBLE, id_var_time_xy(av), & 1649 'seconds', '', 100, 101, 000 ) 1613 1650 ! 1614 1651 !-- Define the spatial dimensions and coordinates for xy-sections. … … 1626 1663 ! 1627 1664 !-- Define vertical coordinate grid (zu grid) 1628 nc_stat = NF90_DEF_DIM( id_set_xy(av), 'zu_xy', ns, id_dim_zu_xy(av) ) 1629 CALL handle_netcdf_error( 'netcdf', 102 ) 1630 1631 nc_stat = NF90_DEF_VAR( id_set_xy(av), 'zu_xy', NF90_DOUBLE, & 1632 id_dim_zu_xy(av), id_var_zu_xy(av) ) 1633 CALL handle_netcdf_error( 'netcdf', 103 ) 1634 1635 nc_stat = NF90_PUT_ATT( id_set_xy(av), id_var_zu_xy(av), 'units', & 1636 'meters' ) 1637 CALL handle_netcdf_error( 'netcdf', 104 ) 1638 1665 CALL netcdf_create_dim( id_set_xy(av), 'zu_xy', ns, & 1666 id_dim_zu_xy(av), 102 ) 1667 CALL netcdf_create_var( id_set_xy(av), (/ id_dim_zu_xy(av) /), & 1668 'zu_xy', NF90_DOUBLE, id_var_zu_xy(av), & 1669 'meters', '', 103, 104, 000 ) 1639 1670 ! 1640 1671 !-- Define vertical coordinate grid (zw grid) 1641 nc_stat = NF90_DEF_DIM( id_set_xy(av), 'zw_xy', ns, id_dim_zw_xy(av) ) 1642 CALL handle_netcdf_error( 'netcdf', 105 ) 1643 1644 nc_stat = NF90_DEF_VAR( id_set_xy(av), 'zw_xy', NF90_DOUBLE, & 1645 id_dim_zw_xy(av), id_var_zw_xy(av) ) 1646 CALL handle_netcdf_error( 'netcdf', 106 ) 1647 1648 nc_stat = NF90_PUT_ATT( id_set_xy(av), id_var_zw_xy(av), 'units', & 1649 'meters' ) 1650 CALL handle_netcdf_error( 'netcdf', 107 ) 1651 1672 CALL netcdf_create_dim( id_set_xy(av), 'zw_xy', ns, & 1673 id_dim_zw_xy(av), 105 ) 1674 CALL netcdf_create_var( id_set_xy(av), (/ id_dim_zw_xy(av) /), & 1675 'zw_xy', NF90_DOUBLE, id_var_zw_xy(av), & 1676 'meters', '', 106, 107, 000 ) 1652 1677 1653 1678 IF ( land_surface ) THEN … … 1659 1684 ! 1660 1685 !-- Define vertical coordinate grid (zs grid) 1661 nc_stat = NF90_DEF_DIM( id_set_xy(av), 'zs_xy', ns_do, id_dim_zs_xy(av) ) 1662 CALL handle_netcdf_error( 'netcdf', 539 ) 1663 1664 nc_stat = NF90_DEF_VAR( id_set_xy(av), 'zs_xy', NF90_DOUBLE, & 1665 id_dim_zs_xy(av), id_var_zs_xy(av) ) 1666 CALL handle_netcdf_error( 'netcdf', 540 ) 1667 1668 nc_stat = NF90_PUT_ATT( id_set_xy(av), id_var_zs_xy(av), 'units', & 1669 'meters' ) 1670 CALL handle_netcdf_error( 'netcdf', 541 ) 1686 CALL netcdf_create_dim( id_set_xy(av), 'zs_xy', ns_do, & 1687 id_dim_zs_xy(av), 539 ) 1688 CALL netcdf_create_var( id_set_xy(av), (/ id_dim_zs_xy(av) /), & 1689 'zs_xy', NF90_DOUBLE, id_var_zs_xy(av), & 1690 'meters', '', 540, 541, 000 ) 1671 1691 1672 1692 ENDIF … … 1675 1695 !-- Define a pseudo vertical coordinate grid for the surface variables 1676 1696 !-- u* and t* to store their height level 1677 nc_stat = NF90_DEF_DIM( id_set_xy(av), 'zu1_xy', 1, & 1678 id_dim_zu1_xy(av) ) 1679 CALL handle_netcdf_error( 'netcdf', 108 ) 1680 1681 nc_stat = NF90_DEF_VAR( id_set_xy(av), 'zu1_xy', NF90_DOUBLE, & 1682 id_dim_zu1_xy(av), id_var_zu1_xy(av) ) 1683 CALL handle_netcdf_error( 'netcdf', 109 ) 1684 1685 nc_stat = NF90_PUT_ATT( id_set_xy(av), id_var_zu1_xy(av), 'units', & 1686 'meters' ) 1687 CALL handle_netcdf_error( 'netcdf', 110 ) 1688 1697 CALL netcdf_create_dim( id_set_xy(av), 'zu1_xy', 1, & 1698 id_dim_zu1_xy(av), 108 ) 1699 CALL netcdf_create_var( id_set_xy(av), (/ id_dim_zu1_xy(av) /), & 1700 'zu1_xy', NF90_DOUBLE, id_var_zu1_xy(av), & 1701 'meters', '', 109, 110, 000 ) 1689 1702 ! 1690 1703 !-- Define a variable to store the layer indices of the horizontal cross 1691 1704 !-- sections, too 1692 nc_stat = NF90_DEF_VAR( id_set_xy(av), 'ind_z_xy', NF90_DOUBLE, & 1693 id_dim_zu_xy(av), id_var_ind_z_xy(av) ) 1694 CALL handle_netcdf_error( 'netcdf', 111 ) 1695 1696 nc_stat = NF90_PUT_ATT( id_set_xy(av), id_var_ind_z_xy(av), 'units', & 1697 'gridpoints') 1698 CALL handle_netcdf_error( 'netcdf', 112 ) 1699 1705 CALL netcdf_create_var( id_set_xy(av), (/ id_dim_zu_xy(av) /), & 1706 'ind_z_xy', NF90_DOUBLE, & 1707 id_var_ind_z_xy(av), 'gridpoints', '', 111, & 1708 112, 000 ) 1700 1709 ! 1701 1710 !-- Define x-axis (for scalar position) 1702 nc_stat = NF90_DEF_DIM( id_set_xy(av), 'x', nx+2, id_dim_x_xy(av) ) 1703 CALL handle_netcdf_error( 'netcdf', 113 ) 1704 1705 nc_stat = NF90_DEF_VAR( id_set_xy(av), 'x', NF90_DOUBLE, & 1706 id_dim_x_xy(av), id_var_x_xy(av) ) 1707 CALL handle_netcdf_error( 'netcdf', 114 ) 1708 1709 1710 nc_stat = NF90_PUT_ATT( id_set_xy(av), id_var_x_xy(av), 'units', & 1711 'meters' ) 1712 CALL handle_netcdf_error( 'netcdf', 115 ) 1713 1711 CALL netcdf_create_dim( id_set_xy(av), 'x', nx+2, id_dim_x_xy(av), & 1712 113 ) 1713 CALL netcdf_create_var( id_set_xy(av), (/ id_dim_x_xy(av) /), 'x', & 1714 NF90_DOUBLE, id_var_x_xy(av), 'meters', '', & 1715 114, 115, 000 ) 1714 1716 ! 1715 1717 !-- Define x-axis (for u position) 1716 nc_stat = NF90_DEF_DIM( id_set_xy(av), 'xu', nx+2, id_dim_xu_xy(av) ) 1717 CALL handle_netcdf_error( 'netcdf', 388 ) 1718 1719 nc_stat = NF90_DEF_VAR( id_set_xy(av), 'xu', NF90_DOUBLE, & 1720 id_dim_xu_xy(av), id_var_xu_xy(av) ) 1721 CALL handle_netcdf_error( 'netcdf', 389 ) 1722 1723 nc_stat = NF90_PUT_ATT( id_set_xy(av), id_var_xu_xy(av), 'units', & 1724 'meters' ) 1725 CALL handle_netcdf_error( 'netcdf', 390 ) 1726 1718 CALL netcdf_create_dim( id_set_xy(av), 'xu', nx+2, & 1719 id_dim_xu_xy(av), 388 ) 1720 CALL netcdf_create_var( id_set_xy(av), (/ id_dim_xu_xy(av) /), 'xu', & 1721 NF90_DOUBLE, id_var_xu_xy(av), 'meters', '', & 1722 389, 390, 000 ) 1727 1723 ! 1728 1724 !-- Define y-axis (for scalar position) 1729 nc_stat = NF90_DEF_DIM( id_set_xy(av), 'y', ny+2, id_dim_y_xy(av) ) 1730 CALL handle_netcdf_error( 'netcdf', 116 ) 1731 1732 nc_stat = NF90_DEF_VAR( id_set_xy(av), 'y', NF90_DOUBLE, & 1733 id_dim_y_xy(av), id_var_y_xy(av) ) 1734 CALL handle_netcdf_error( 'netcdf', 117 ) 1735 1736 nc_stat = NF90_PUT_ATT( id_set_xy(av), id_var_y_xy(av), 'units', & 1737 'meters' ) 1738 CALL handle_netcdf_error( 'netcdf', 118 ) 1739 1725 CALL netcdf_create_dim( id_set_xy(av), 'y', ny+2, id_dim_y_xy(av), & 1726 116 ) 1727 CALL netcdf_create_var( id_set_xy(av), (/ id_dim_y_xy(av) /), 'y', & 1728 NF90_DOUBLE, id_var_y_xy(av), 'meters', '', & 1729 117, 118, 000 ) 1740 1730 ! 1741 1731 !-- Define y-axis (for scalar position) 1742 nc_stat = NF90_DEF_DIM( id_set_xy(av), 'yv', ny+2, id_dim_yv_xy(av) ) 1743 CALL handle_netcdf_error( 'netcdf', 364 ) 1744 1745 nc_stat = NF90_DEF_VAR( id_set_xy(av), 'yv', NF90_DOUBLE, & 1746 id_dim_yv_xy(av), id_var_yv_xy(av) ) 1747 CALL handle_netcdf_error( 'netcdf', 365 ) 1748 1749 nc_stat = NF90_PUT_ATT( id_set_xy(av), id_var_yv_xy(av), 'units', & 1750 'meters' ) 1751 CALL handle_netcdf_error( 'netcdf', 366 ) 1752 1732 CALL netcdf_create_dim( id_set_xy(av), 'yv', ny+2, & 1733 id_dim_yv_xy(av), 364 ) 1734 CALL netcdf_create_var( id_set_xy(av), (/ id_dim_yv_xy(av) /), 'yv', & 1735 NF90_DOUBLE, id_var_yv_xy(av), 'meters', '', & 1736 365, 366, 000 ) 1753 1737 ! 1754 1738 !-- In case of non-flat topography define 2d-arrays containing the height … … 1757 1741 ! 1758 1742 !-- Define zusi = zu(nzb_s_inner) 1759 nc_stat = NF90_DEF_VAR( id_set_xy(av), 'zusi', NF90_DOUBLE, & 1760 (/ id_dim_x_xy(av), id_dim_y_xy(av) /), & 1761 id_var_zusi_xy(av) ) 1762 CALL handle_netcdf_error( 'netcdf', 421 ) 1763 1764 nc_stat = NF90_PUT_ATT( id_set_xy(av), id_var_zusi_xy(av), & 1765 'units', 'meters' ) 1766 CALL handle_netcdf_error( 'netcdf', 422 ) 1767 1768 nc_stat = NF90_PUT_ATT( id_set_xy(av), id_var_zusi_xy(av), & 1769 'long_name', 'zu(nzb_s_inner)' ) 1770 CALL handle_netcdf_error( 'netcdf', 423 ) 1771 1743 CALL netcdf_create_var( id_set_xy(av), (/ id_dim_x_xy(av), & 1744 id_dim_y_xy(av) /), 'zusi', NF90_DOUBLE, & 1745 id_var_zusi_xy(av), 'meters', & 1746 'zu(nzb_s_inner)', 421, 422, 423 ) 1772 1747 ! 1773 1748 !-- Define zwwi = zw(nzb_w_inner) 1774 nc_stat = NF90_DEF_VAR( id_set_xy(av), 'zwwi', NF90_DOUBLE, & 1775 (/ id_dim_x_xy(av), id_dim_y_xy(av) /), & 1776 id_var_zwwi_xy(av) ) 1777 CALL handle_netcdf_error( 'netcdf', 424 ) 1778 1779 nc_stat = NF90_PUT_ATT( id_set_xy(av), id_var_zwwi_xy(av), & 1780 'units', 'meters' ) 1781 CALL handle_netcdf_error( 'netcdf', 425 ) 1782 1783 nc_stat = NF90_PUT_ATT( id_set_xy(av), id_var_zwwi_xy(av), & 1784 'long_name', 'zw(nzb_w_inner)' ) 1785 CALL handle_netcdf_error( 'netcdf', 426 ) 1749 CALL netcdf_create_var( id_set_xy(av), (/ id_dim_x_xy(av), & 1750 id_dim_y_xy(av) /), 'zwwi', NF90_DOUBLE, & 1751 id_var_zwwi_xy(av), 'meters', & 1752 'zw(nzb_w_inner)', 424, 425, 426 ) 1786 1753 1787 1754 ENDIF … … 1800 1767 IF ( INDEX( do2d(av,i), '*' ) /= 0 ) THEN 1801 1768 1802 nc_stat = NF90_DEF_VAR( id_set_xy(av), do2d(av,i), & 1803 nc_precision(1), & 1804 (/ id_dim_x_xy(av), id_dim_y_xy(av),& 1805 id_dim_zu1_xy(av), & 1806 id_dim_time_xy(av) /), & 1807 id_var_do2d(av,i) ) 1808 1809 var_list = TRIM(var_list) // TRIM( do2d(av,i) ) // ';' 1769 CALL netcdf_create_var( id_set_xy(av), (/ id_dim_x_xy(av), & 1770 id_dim_y_xy(av), id_dim_zu1_xy(av), & 1771 id_dim_time_xy(av) /), do2d(av,i), & 1772 nc_precision(1), id_var_do2d(av,i), & 1773 TRIM( do2d_unit(av,i) ), & 1774 do2d(av,i), 119, 120, 354 ) 1810 1775 1811 1776 ELSE … … 1862 1827 grid_x, grid_y, grid_z ) 1863 1828 1829 IF ( .NOT. found ) THEN 1830 WRITE ( message_string, * ) 'no grid defined for', & 1831 ' variable ', TRIM( do2d(av,i) ) 1832 CALL message( 'define_netcdf_header', 'PA0244', & 1833 0, 1, 0, 6, 0 ) 1834 ENDIF 1835 1864 1836 END SELECT 1865 1837 … … 1888 1860 ! 1889 1861 !-- Define the grid 1890 nc_stat = NF90_DEF_VAR( id_set_xy(av), do2d(av,i), & 1891 nc_precision(1), & 1892 (/ id_x, id_y, id_z, id_dim_time_xy(av) /), & 1893 id_var_do2d(av,i) ) 1894 1895 IF ( .NOT. found ) THEN 1896 WRITE ( message_string, * ) 'no grid defined for', & 1897 ' variable ', TRIM( do2d(av,i) ) 1898 CALL message( 'define_netcdf_header', 'PA0244',& 1899 0, 1, 0, 6, 0 ) 1900 ENDIF 1901 1902 var_list = TRIM( var_list ) // TRIM( do2d(av,i) ) // ';' 1862 CALL netcdf_create_var( id_set_xy(av), (/ id_x, id_y, id_z, & 1863 id_dim_time_xy(av) /), do2d(av,i), & 1864 nc_precision(1), id_var_do2d(av,i), & 1865 TRIM( do2d_unit(av,i) ), & 1866 do2d(av,i), 119, 120, 354 ) 1903 1867 1904 1868 ENDIF 1905 1869 1906 CALL handle_netcdf_error( 'netcdf', 119 )1907 !1908 !-- Store the 'real' name of the variable (with *, for example)1909 !-- in the long_name attribute. This is evaluated by Ferret,1910 !-- for example.1911 nc_stat = NF90_PUT_ATT( id_set_xy(av), id_var_do2d(av,i), &1912 'long_name', do2d(av,i) )1913 CALL handle_netcdf_error( 'netcdf', 120 )1914 !1915 !-- Define the variable's unit1916 nc_stat = NF90_PUT_ATT( id_set_xy(av), id_var_do2d(av,i), &1917 'units', TRIM( do2d_unit(av,i) ) )1918 CALL handle_netcdf_error( 'netcdf', 354 )1919 1870 #if defined( __netcdf4_parallel ) 1920 1871 IF ( netcdf_data_format > 4 ) THEN … … 1924 1875 id_var_do2d(av,i), & 1925 1876 1, 0 ) 1926 CALL handle_netcdf_error( 'netcdf', 533 )1877 CALL netcdf_handle_error( 'netcdf_define_header', 533 ) 1927 1878 ! 1928 1879 !-- Set collective io operations for parallel io … … 1930 1881 id_var_do2d(av,i), & 1931 1882 NF90_COLLECTIVE ) 1932 CALL handle_netcdf_error( 'netcdf', 448 )1883 CALL netcdf_handle_error( 'netcdf_define_header', 448 ) 1933 1884 ENDIF 1934 1885 #endif 1886 var_list = TRIM( var_list) // TRIM( do2d(av,i) ) // ';' 1887 1935 1888 ENDIF 1936 1889 … … 1948 1901 nc_stat = NF90_PUT_ATT( id_set_xy(av), NF90_GLOBAL, 'VAR_LIST', & 1949 1902 var_list ) 1950 CALL handle_netcdf_error( 'netcdf', 121 )1903 CALL netcdf_handle_error( 'netcdf_define_header', 121 ) 1951 1904 1952 1905 ! … … 1954 1907 !-- parallel output. 1955 1908 nc_stat = NF90_SET_FILL( id_set_xy(av), NF90_NOFILL, oldmode ) 1956 CALL handle_netcdf_error( 'netcdf', 529 )1909 CALL netcdf_handle_error( 'netcdf_define_header', 529 ) 1957 1910 1958 1911 ! 1959 1912 !-- Leave netCDF define mode 1960 1913 nc_stat = NF90_ENDDEF( id_set_xy(av) ) 1961 CALL handle_netcdf_error( 'netcdf', 122 )1914 CALL netcdf_handle_error( 'netcdf_define_header', 122 ) 1962 1915 1963 1916 ! … … 1982 1935 netcdf_data, start = (/ 1 /), & 1983 1936 count = (/ ns /) ) 1984 CALL handle_netcdf_error( 'netcdf', 123 )1937 CALL netcdf_handle_error( 'netcdf_define_header', 123 ) 1985 1938 1986 1939 ! … … 1996 1949 netcdf_data, start = (/ 1 /), & 1997 1950 count = (/ ns /) ) 1998 CALL handle_netcdf_error( 'netcdf', 124 )1951 CALL netcdf_handle_error( 'netcdf_define_header', 124 ) 1999 1952 2000 1953 ! … … 2015 1968 netcdf_data(1:ns_do), start = (/ 1 /), & 2016 1969 count = (/ ns_do /) ) 2017 CALL handle_netcdf_error( 'netcdf', 124 )1970 CALL netcdf_handle_error( 'netcdf_define_header', 124 ) 2018 1971 2019 1972 ENDIF … … 2025 1978 netcdf_data, start = (/ 1 /), & 2026 1979 count = (/ ns /) ) 2027 CALL handle_netcdf_error( 'netcdf', 125 )1980 CALL netcdf_handle_error( 'netcdf_define_header', 125 ) 2028 1981 2029 1982 DEALLOCATE( netcdf_data ) … … 2034 1987 (/ zu(nzb+1) /), start = (/ 1 /), & 2035 1988 count = (/ 1 /) ) 2036 CALL handle_netcdf_error( 'netcdf', 126 )1989 CALL netcdf_handle_error( 'netcdf_define_header', 126 ) 2037 1990 2038 1991 ! … … 2047 2000 netcdf_data, start = (/ 1 /), & 2048 2001 count = (/ nx+2 /) ) 2049 CALL handle_netcdf_error( 'netcdf', 127 )2002 CALL netcdf_handle_error( 'netcdf_define_header', 127 ) 2050 2003 2051 2004 DO i = 0, nx+1 … … 2056 2009 netcdf_data, start = (/ 1 /), & 2057 2010 count = (/ nx+2 /) ) 2058 CALL handle_netcdf_error( 'netcdf', 367 )2011 CALL netcdf_handle_error( 'netcdf_define_header', 367 ) 2059 2012 2060 2013 DEALLOCATE( netcdf_data ) … … 2071 2024 netcdf_data, start = (/ 1 /), & 2072 2025 count = (/ ny+2 /)) 2073 CALL handle_netcdf_error( 'netcdf', 128 )2026 CALL netcdf_handle_error( 'netcdf_define_header', 128 ) 2074 2027 2075 2028 DO i = 0, ny+1 … … 2080 2033 netcdf_data, start = (/ 1 /), & 2081 2034 count = (/ ny+2 /)) 2082 CALL handle_netcdf_error( 'netcdf', 368 )2035 CALL netcdf_handle_error( 'netcdf_define_header', 368 ) 2083 2036 2084 2037 DEALLOCATE( netcdf_data ) … … 2092 2045 start = (/ 1, 1 /), & 2093 2046 count = (/ nx+2, ny+2 /) ) 2094 CALL handle_netcdf_error( 'netcdf', 427 )2047 CALL netcdf_handle_error( 'netcdf_define_header', 427 ) 2095 2048 2096 2049 nc_stat = NF90_PUT_VAR( id_set_xy(av), id_var_zwwi_xy(av), & … … 2098 2051 start = (/ 1, 1 /), & 2099 2052 count = (/ nx+2, ny+2 /) ) 2100 CALL handle_netcdf_error( 'netcdf', 428 )2053 CALL netcdf_handle_error( 'netcdf_define_header', 428 ) 2101 2054 2102 2055 ENDIF … … 2115 2068 nc_stat = NF90_GET_ATT( id_set_xy(av), NF90_GLOBAL, 'VAR_LIST', & 2116 2069 var_list_old ) 2117 CALL handle_netcdf_error( 'netcdf', 129 )2070 CALL netcdf_handle_error( 'netcdf_define_header', 129 ) 2118 2071 2119 2072 var_list = ';' … … 2154 2107 !-- Get and compare the number of horizontal cross sections 2155 2108 nc_stat = NF90_INQ_VARID( id_set_xy(av), 'zu_xy', id_var_zu_xy(av) ) 2156 CALL handle_netcdf_error( 'netcdf', 130 )2109 CALL netcdf_handle_error( 'netcdf_define_header', 130 ) 2157 2110 2158 2111 nc_stat = NF90_INQUIRE_VARIABLE( id_set_xy(av), id_var_zu_xy(av), & 2159 2112 dimids = id_dim_zu_xy_old ) 2160 CALL handle_netcdf_error( 'netcdf', 131 )2113 CALL netcdf_handle_error( 'netcdf_define_header', 131 ) 2161 2114 id_dim_zu_xy(av) = id_dim_zu_xy_old(1) 2162 2115 2163 2116 nc_stat = NF90_INQUIRE_DIMENSION( id_set_xy(av), id_dim_zu_xy(av), & 2164 2117 len = ns_old ) 2165 CALL handle_netcdf_error( 'netcdf', 132 )2118 CALL netcdf_handle_error( 'netcdf_define_header', 132 ) 2166 2119 2167 2120 IF ( ns /= ns_old ) THEN … … 2182 2135 2183 2136 nc_stat = NF90_GET_VAR( id_set_xy(av), id_var_zu_xy(av), netcdf_data ) 2184 CALL handle_netcdf_error( 'netcdf', 133 )2137 CALL netcdf_handle_error( 'netcdf_define_header', 133 ) 2185 2138 2186 2139 DO i = 1, ns … … 2222 2175 !-- on the file. 2223 2176 nc_stat = NF90_INQ_VARID( id_set_xy(av), 'time', id_var_time_xy(av) ) 2224 CALL handle_netcdf_error( 'netcdf', 134 )2177 CALL netcdf_handle_error( 'netcdf_define_header', 134 ) 2225 2178 2226 2179 nc_stat = NF90_INQUIRE_VARIABLE( id_set_xy(av), id_var_time_xy(av), & 2227 2180 dimids = id_dim_time_old ) 2228 CALL handle_netcdf_error( 'netcdf', 135 )2181 CALL netcdf_handle_error( 'netcdf_define_header', 135 ) 2229 2182 id_dim_time_xy(av) = id_dim_time_old(1) 2230 2183 2231 2184 nc_stat = NF90_INQUIRE_DIMENSION( id_set_xy(av), id_dim_time_xy(av), & 2232 2185 len = ntime_count ) 2233 CALL handle_netcdf_error( 'netcdf', 136 )2186 CALL netcdf_handle_error( 'netcdf_define_header', 136 ) 2234 2187 2235 2188 ! … … 2244 2197 start = (/ do2d_xy_time_count(av) /), & 2245 2198 count = (/ 1 /) ) 2246 CALL handle_netcdf_error( 'netcdf', 137 )2199 CALL netcdf_handle_error( 'netcdf_define_header', 137 ) 2247 2200 2248 2201 IF ( last_time_coordinate(1) >= simulated_time ) THEN … … 2315 2268 nc_stat = NF90_INQ_VARID( id_set_xy(av), do2d(av,i), & 2316 2269 id_var_do2d(av,i) ) 2317 CALL handle_netcdf_error( 'netcdf', 138 )2270 CALL netcdf_handle_error( 'netcdf_define_header', 138 ) 2318 2271 #if defined( __netcdf4_parallel ) 2319 2272 ! … … 2323 2276 id_var_do2d(av,i), & 2324 2277 NF90_COLLECTIVE ) 2325 CALL handle_netcdf_error( 'netcdf', 454 )2278 CALL netcdf_handle_error( 'netcdf_define_header', 454 ) 2326 2279 ENDIF 2327 2280 #endif … … 2344 2297 ENDIF 2345 2298 nc_stat = NF90_REDEF( id_set_xy(av) ) 2346 CALL handle_netcdf_error( 'netcdf', 431 )2299 CALL netcdf_handle_error( 'netcdf_define_header', 431 ) 2347 2300 nc_stat = NF90_PUT_ATT( id_set_xy(av), NF90_GLOBAL, 'title', & 2348 2301 TRIM( run_description_header ) // & 2349 2302 TRIM( time_average_text ) ) 2350 CALL handle_netcdf_error( 'netcdf', 139 )2303 CALL netcdf_handle_error( 'netcdf_define_header', 139 ) 2351 2304 nc_stat = NF90_ENDDEF( id_set_xy(av) ) 2352 CALL handle_netcdf_error( 'netcdf', 432 )2305 CALL netcdf_handle_error( 'netcdf_define_header', 432 ) 2353 2306 message_string = 'netCDF file for cross-sections ' // & 2354 2307 TRIM( var ) // ' from previous run found.' // & … … 2363 2316 nc_stat = NF90_PUT_ATT( id_set_xz(av), NF90_GLOBAL, 'Conventions', & 2364 2317 'COARDS' ) 2365 CALL handle_netcdf_error( 'netcdf', 140 )2318 CALL netcdf_handle_error( 'netcdf_define_header', 140 ) 2366 2319 2367 2320 IF ( av == 0 ) THEN … … 2374 2327 TRIM( run_description_header ) // & 2375 2328 TRIM( time_average_text ) ) 2376 CALL handle_netcdf_error( 'netcdf', 141 )2329 CALL netcdf_handle_error( 'netcdf_define_header', 141 ) 2377 2330 IF ( av == 1 ) THEN 2378 2331 WRITE ( time_average_text,'(F7.1,'' s avg'')' ) averaging_interval 2379 2332 nc_stat = NF90_PUT_ATT( id_set_xz(av), NF90_GLOBAL, 'time_avg', & 2380 2333 TRIM( time_average_text ) ) 2381 CALL handle_netcdf_error( 'netcdf', 141 )2334 CALL netcdf_handle_error( 'netcdf_define_header', 141 ) 2382 2335 ENDIF 2383 2336 … … 2387 2340 !-- the performance drops significantly. 2388 2341 IF ( netcdf_data_format < 5 ) THEN 2389 nc_stat = NF90_DEF_DIM( id_set_xz(av), 'time', NF90_UNLIMITED, & 2390 id_dim_time_xz(av) ) 2391 CALL handle_netcdf_error( 'netcdf', 142 ) 2342 CALL netcdf_create_dim( id_set_xz(av), 'time', NF90_UNLIMITED, & 2343 id_dim_time_xz(av), 142 ) 2392 2344 ELSE 2393 nc_stat = NF90_DEF_DIM( id_set_xz(av), 'time', ntdim_2d_xz(av), & 2394 id_dim_time_xz(av) ) 2395 CALL handle_netcdf_error( 'netcdf', 525 ) 2396 ENDIF 2397 2398 nc_stat = NF90_DEF_VAR( id_set_xz(av), 'time', NF90_DOUBLE, & 2399 id_dim_time_xz(av), id_var_time_xz(av) ) 2400 CALL handle_netcdf_error( 'netcdf', 143 ) 2401 2402 nc_stat = NF90_PUT_ATT( id_set_xz(av), id_var_time_xz(av), 'units', & 2403 'seconds') 2404 CALL handle_netcdf_error( 'netcdf', 144 ) 2405 2345 CALL netcdf_create_dim( id_set_xz(av), 'time', ntdim_2d_xz(av), & 2346 id_dim_time_xz(av), 525 ) 2347 ENDIF 2348 2349 CALL netcdf_create_var( id_set_xz(av), (/ id_dim_time_xz(av) /), & 2350 'time', NF90_DOUBLE, id_var_time_xz(av), & 2351 'seconds', '', 143, 144, 000 ) 2406 2352 ! 2407 2353 !-- Define the spatial dimensions and coordinates for xz-sections. … … 2419 2365 ! 2420 2366 !-- Define y-axis (for scalar position) 2421 nc_stat = NF90_DEF_DIM( id_set_xz(av), 'y_xz', ns, id_dim_y_xz(av) ) 2422 CALL handle_netcdf_error( 'netcdf', 145 ) 2423 2424 nc_stat = NF90_DEF_VAR( id_set_xz(av), 'y_xz', NF90_DOUBLE, & 2425 id_dim_y_xz(av), id_var_y_xz(av) ) 2426 CALL handle_netcdf_error( 'netcdf', 146 ) 2427 2428 nc_stat = NF90_PUT_ATT( id_set_xz(av), id_var_y_xz(av), 'units', & 2429 'meters' ) 2430 CALL handle_netcdf_error( 'netcdf', 147 ) 2431 2367 CALL netcdf_create_dim( id_set_xz(av), 'y_xz', ns, id_dim_y_xz(av), & 2368 145 ) 2369 CALL netcdf_create_var( id_set_xz(av), (/ id_dim_y_xz(av) /), & 2370 'y_xz', NF90_DOUBLE, id_var_y_xz(av), & 2371 'meters', '', 146, 147, 000 ) 2432 2372 ! 2433 2373 !-- Define y-axis (for v position) 2434 nc_stat = NF90_DEF_DIM( id_set_xz(av), 'yv_xz', ns, id_dim_yv_xz(av) ) 2435 CALL handle_netcdf_error( 'netcdf', 369 ) 2436 2437 nc_stat = NF90_DEF_VAR( id_set_xz(av), 'yv_xz', NF90_DOUBLE, & 2438 id_dim_yv_xz(av), id_var_yv_xz(av) ) 2439 CALL handle_netcdf_error( 'netcdf', 370 ) 2440 2441 nc_stat = NF90_PUT_ATT( id_set_xz(av), id_var_yv_xz(av), 'units', & 2442 'meters' ) 2443 CALL handle_netcdf_error( 'netcdf', 371 ) 2444 2374 CALL netcdf_create_dim( id_set_xz(av), 'yv_xz', ns, & 2375 id_dim_yv_xz(av), 369 ) 2376 CALL netcdf_create_var( id_set_xz(av), (/ id_dim_yv_xz(av) /), & 2377 'yv_xz', NF90_DOUBLE, id_var_yv_xz(av), & 2378 'meters', '', 370, 371, 000 ) 2445 2379 ! 2446 2380 !-- Define a variable to store the layer indices of the vertical cross 2447 2381 !-- sections 2448 nc_stat = NF90_DEF_VAR( id_set_xz(av), 'ind_y_xz', NF90_DOUBLE, & 2449 id_dim_y_xz(av), id_var_ind_y_xz(av) ) 2450 CALL handle_netcdf_error( 'netcdf', 148 ) 2451 2452 nc_stat = NF90_PUT_ATT( id_set_xz(av), id_var_ind_y_xz(av), 'units', & 2453 'gridpoints') 2454 CALL handle_netcdf_error( 'netcdf', 149 ) 2455 2382 CALL netcdf_create_var( id_set_xz(av), (/ id_dim_y_xz(av) /), & 2383 'ind_y_xz', NF90_DOUBLE, & 2384 id_var_ind_y_xz(av), 'gridpoints', '', 148, & 2385 149, 000 ) 2456 2386 ! 2457 2387 !-- Define x-axis (for scalar position) 2458 nc_stat = NF90_DEF_DIM( id_set_xz(av), 'x', nx+2, id_dim_x_xz(av) ) 2459 CALL handle_netcdf_error( 'netcdf', 150 ) 2460 2461 nc_stat = NF90_DEF_VAR( id_set_xz(av), 'x', NF90_DOUBLE, & 2462 id_dim_x_xz(av), id_var_x_xz(av) ) 2463 CALL handle_netcdf_error( 'netcdf', 151 ) 2464 2465 nc_stat = NF90_PUT_ATT( id_set_xz(av), id_var_x_xz(av), 'units', & 2466 'meters' ) 2467 CALL handle_netcdf_error( 'netcdf', 152 ) 2468 2388 CALL netcdf_create_dim( id_set_xz(av), 'x', nx+2, id_dim_x_xz(av), & 2389 150 ) 2390 CALL netcdf_create_var( id_set_xz(av), (/ id_dim_x_xz(av) /), 'x', & 2391 NF90_DOUBLE, id_var_x_xz(av), 'meters', '', & 2392 151, 152, 000 ) 2469 2393 ! 2470 2394 !-- Define x-axis (for u position) 2471 nc_stat = NF90_DEF_DIM( id_set_xz(av), 'xu', nx+2, id_dim_xu_xz(av) ) 2472 CALL handle_netcdf_error( 'netcdf', 372 ) 2473 2474 nc_stat = NF90_DEF_VAR( id_set_xz(av), 'xu', NF90_DOUBLE, & 2475 id_dim_xu_xz(av), id_var_xu_xz(av) ) 2476 CALL handle_netcdf_error( 'netcdf', 373 ) 2477 2478 nc_stat = NF90_PUT_ATT( id_set_xz(av), id_var_xu_xz(av), 'units', & 2479 'meters' ) 2480 CALL handle_netcdf_error( 'netcdf', 374 ) 2481 2395 CALL netcdf_create_dim( id_set_xz(av), 'xu', nx+2, id_dim_xu_xz(av), & 2396 372 ) 2397 CALL netcdf_create_var( id_set_xz(av), (/ id_dim_xu_xz(av) /), 'xu', & 2398 NF90_DOUBLE, id_var_xu_xz(av), 'meters', '', & 2399 373, 374, 000 ) 2482 2400 ! 2483 2401 !-- Define the three z-axes (zu, zw, and zs) 2484 nc_stat = NF90_DEF_DIM( id_set_xz(av), 'zu', nz+2, id_dim_zu_xz(av) ) 2485 CALL handle_netcdf_error( 'netcdf', 153 ) 2486 2487 nc_stat = NF90_DEF_VAR( id_set_xz(av), 'zu', NF90_DOUBLE, & 2488 id_dim_zu_xz(av), id_var_zu_xz(av) ) 2489 CALL handle_netcdf_error( 'netcdf', 154 ) 2490 2491 nc_stat = NF90_PUT_ATT( id_set_xz(av), id_var_zu_xz(av), 'units', & 2492 'meters' ) 2493 CALL handle_netcdf_error( 'netcdf', 155 ) 2494 2495 nc_stat = NF90_DEF_DIM( id_set_xz(av), 'zw', nz+2, id_dim_zw_xz(av) ) 2496 CALL handle_netcdf_error( 'netcdf', 156 ) 2497 2498 nc_stat = NF90_DEF_VAR( id_set_xz(av), 'zw', NF90_DOUBLE, & 2499 id_dim_zw_xz(av), id_var_zw_xz(av) ) 2500 CALL handle_netcdf_error( 'netcdf', 157 ) 2501 2502 nc_stat = NF90_PUT_ATT( id_set_xz(av), id_var_zw_xz(av), 'units', & 2503 'meters' ) 2504 CALL handle_netcdf_error( 'netcdf', 158 ) 2402 CALL netcdf_create_dim( id_set_xz(av), 'zu', nz+2, id_dim_zu_xz(av), & 2403 153 ) 2404 CALL netcdf_create_var( id_set_xz(av), (/ id_dim_zu_xz(av) /), 'zu', & 2405 NF90_DOUBLE, id_var_zu_xz(av), 'meters', '', & 2406 154, 155, 000 ) 2407 CALL netcdf_create_dim( id_set_xz(av), 'zw', nz+2, id_dim_zw_xz(av), & 2408 156 ) 2409 CALL netcdf_create_var( id_set_xz(av), (/ id_dim_zw_xz(av) /), 'zw', & 2410 NF90_DOUBLE, id_var_zw_xz(av), 'meters', '', & 2411 157, 158, 000 ) 2505 2412 2506 2413 IF ( land_surface ) THEN 2507 2414 2508 nc_stat = NF90_DEF_DIM( id_set_xz(av), 'zs', nzs, id_dim_zs_xz(av) ) 2509 CALL handle_netcdf_error( 'netcdf', 542 ) 2510 2511 nc_stat = NF90_DEF_VAR( id_set_xz(av), 'zs', NF90_DOUBLE, & 2512 id_dim_zs_xz(av), id_var_zs_xz(av) ) 2513 CALL handle_netcdf_error( 'netcdf', 543 ) 2514 2515 nc_stat = NF90_PUT_ATT( id_set_xz(av), id_var_zs_xz(av), 'units', & 2516 'meters' ) 2517 CALL handle_netcdf_error( 'netcdf', 544 ) 2415 CALL netcdf_create_dim( id_set_xz(av), 'zs', nzs, & 2416 id_dim_zs_xz(av), 542 ) 2417 CALL netcdf_create_var( id_set_xz(av), (/ id_dim_zs_xz(av) /), & 2418 'zs', NF90_DOUBLE, id_var_zs_xz(av), & 2419 'meters', '', 543, 544, 000 ) 2518 2420 2519 2421 ENDIF … … 2580 2482 CALL user_define_netcdf_grid( do2d(av,i), found, & 2581 2483 grid_x, grid_y, grid_z ) 2484 IF ( .NOT. found ) THEN 2485 WRITE ( message_string, * ) 'no grid defined for', & 2486 ' variable ', TRIM( do2d(av,i) ) 2487 CALL message( 'define_netcdf_header', 'PA0244', & 2488 0, 1, 0, 6, 0 ) 2489 ENDIF 2582 2490 2583 2491 END SELECT … … 2607 2515 ! 2608 2516 !-- Define the grid 2609 nc_stat = NF90_DEF_VAR( id_set_xz(av), do2d(av,i), & 2610 nc_precision(2), & 2611 (/ id_x, id_y, id_z, id_dim_time_xz(av) /), & 2612 id_var_do2d(av,i) ) 2613 2614 IF ( .NOT. found ) THEN 2615 WRITE ( message_string, * ) 'no grid defined for', & 2616 ' variable ', TRIM( do2d(av,i) ) 2617 CALL message( 'define_netcdf_header', 'PA0244',& 2618 0, 1, 0, 6, 0 ) 2619 ENDIF 2620 2621 var_list = TRIM( var_list ) // TRIM( do2d(av,i) ) // ';' 2622 2623 CALL handle_netcdf_error( 'netcdf', 159 ) 2624 ! 2625 !-- Store the 'real' name of the variable (with *, for example) 2626 !-- in the long_name attribute. This is evaluated by Ferret, 2627 !-- for example. 2628 nc_stat = NF90_PUT_ATT( id_set_xz(av), id_var_do2d(av,i), & 2629 'long_name', do2d(av,i) ) 2630 CALL handle_netcdf_error( 'netcdf', 160 ) 2631 ! 2632 !-- Define the variable's unit 2633 nc_stat = NF90_PUT_ATT( id_set_xz(av), id_var_do2d(av,i), & 2634 'units', TRIM( do2d_unit(av,i) ) ) 2635 CALL handle_netcdf_error( 'netcdf', 355 ) 2517 CALL netcdf_create_var( id_set_xz(av), (/ id_x, id_y, id_z, & 2518 id_dim_time_xz(av) /), do2d(av,i), & 2519 nc_precision(2), id_var_do2d(av,i), & 2520 TRIM( do2d_unit(av,i) ), do2d(av,i), & 2521 159, 160, 355 ) 2522 2636 2523 #if defined( __netcdf4_parallel ) 2637 2524 … … 2642 2529 id_var_do2d(av,i), & 2643 2530 1, 0 ) 2644 CALL handle_netcdf_error( 'netcdf', 534 )2531 CALL netcdf_handle_error( 'netcdf_define_header', 534 ) 2645 2532 ! 2646 2533 !-- Set independent io operations for parallel io. Collective io … … 2664 2551 ! NF90_INDEPENDENT ) 2665 2552 ENDIF 2666 CALL handle_netcdf_error( 'netcdf', 449 )2553 CALL netcdf_handle_error( 'netcdf_define_header', 449 ) 2667 2554 ENDIF 2668 2555 #endif 2556 var_list = TRIM( var_list ) // TRIM( do2d(av,i) ) // ';' 2557 2669 2558 ENDIF 2670 2559 … … 2682 2571 nc_stat = NF90_PUT_ATT( id_set_xz(av), NF90_GLOBAL, 'VAR_LIST', & 2683 2572 var_list ) 2684 CALL handle_netcdf_error( 'netcdf', 161 )2573 CALL netcdf_handle_error( 'netcdf_define_header', 161 ) 2685 2574 2686 2575 ! … … 2688 2577 !-- parallel output. 2689 2578 nc_stat = NF90_SET_FILL( id_set_xz(av), NF90_NOFILL, oldmode ) 2690 CALL handle_netcdf_error( 'netcdf', 530 )2579 CALL netcdf_handle_error( 'netcdf_define_header', 530 ) 2691 2580 2692 2581 ! 2693 2582 !-- Leave netCDF define mode 2694 2583 nc_stat = NF90_ENDDEF( id_set_xz(av) ) 2695 CALL handle_netcdf_error( 'netcdf', 162 )2584 CALL netcdf_handle_error( 'netcdf_define_header', 162 ) 2696 2585 2697 2586 ! … … 2716 2605 netcdf_data, start = (/ 1 /), & 2717 2606 count = (/ ns /) ) 2718 CALL handle_netcdf_error( 'netcdf', 163 )2607 CALL netcdf_handle_error( 'netcdf_define_header', 163 ) 2719 2608 2720 2609 ! … … 2730 2619 netcdf_data, start = (/ 1 /), & 2731 2620 count = (/ ns /) ) 2732 CALL handle_netcdf_error( 'netcdf', 375 )2621 CALL netcdf_handle_error( 'netcdf_define_header', 375 ) 2733 2622 2734 2623 ! … … 2738 2627 netcdf_data, start = (/ 1 /), & 2739 2628 count = (/ ns /) ) 2740 CALL handle_netcdf_error( 'netcdf', 164 )2629 CALL netcdf_handle_error( 'netcdf_define_header', 164 ) 2741 2630 2742 2631 … … 2754 2643 netcdf_data, start = (/ 1 /), & 2755 2644 count = (/ nx+2 /) ) 2756 CALL handle_netcdf_error( 'netcdf', 165 )2645 CALL netcdf_handle_error( 'netcdf_define_header', 165 ) 2757 2646 2758 2647 DO i = 0, nx+1 … … 2763 2652 netcdf_data, start = (/ 1 /), & 2764 2653 count = (/ nx+2 /) ) 2765 CALL handle_netcdf_error( 'netcdf', 377 )2654 CALL netcdf_handle_error( 'netcdf_define_header', 377 ) 2766 2655 2767 2656 DEALLOCATE( netcdf_data ) … … 2775 2664 netcdf_data, start = (/ 1 /), & 2776 2665 count = (/ nz+2 /) ) 2777 CALL handle_netcdf_error( 'netcdf', 166 )2666 CALL netcdf_handle_error( 'netcdf_define_header', 166 ) 2778 2667 2779 2668 netcdf_data(0:nz+1) = zw(nzb:nzt+1) … … 2781 2670 netcdf_data, start = (/ 1 /), & 2782 2671 count = (/ nz+2 /) ) 2783 CALL handle_netcdf_error( 'netcdf', 167 )2672 CALL netcdf_handle_error( 'netcdf_define_header', 167 ) 2784 2673 2785 2674 ! … … 2790 2679 netcdf_data(0:nzs), start = (/ 1 /), & 2791 2680 count = (/ nzt_soil-nzb_soil+1 /) ) 2792 CALL handle_netcdf_error( 'netcdf', 548 )2681 CALL netcdf_handle_error( 'netcdf_define_header', 548 ) 2793 2682 ENDIF 2794 2683 … … 2808 2697 nc_stat = NF90_GET_ATT( id_set_xz(av), NF90_GLOBAL, 'VAR_LIST', & 2809 2698 var_list_old ) 2810 CALL handle_netcdf_error( 'netcdf', 168 )2699 CALL netcdf_handle_error( 'netcdf_define_header', 168 ) 2811 2700 2812 2701 var_list = ';' … … 2847 2736 !-- Get and compare the number of vertical cross sections 2848 2737 nc_stat = NF90_INQ_VARID( id_set_xz(av), 'y_xz', id_var_y_xz(av) ) 2849 CALL handle_netcdf_error( 'netcdf', 169 )2738 CALL netcdf_handle_error( 'netcdf_define_header', 169 ) 2850 2739 2851 2740 nc_stat = NF90_INQUIRE_VARIABLE( id_set_xz(av), id_var_y_xz(av), & 2852 2741 dimids = id_dim_y_xz_old ) 2853 CALL handle_netcdf_error( 'netcdf', 170 )2742 CALL netcdf_handle_error( 'netcdf_define_header', 170 ) 2854 2743 id_dim_y_xz(av) = id_dim_y_xz_old(1) 2855 2744 2856 2745 nc_stat = NF90_INQUIRE_DIMENSION( id_set_xz(av), id_dim_y_xz(av), & 2857 2746 len = ns_old ) 2858 CALL handle_netcdf_error( 'netcdf', 171 )2747 CALL netcdf_handle_error( 'netcdf_define_header', 171 ) 2859 2748 2860 2749 IF ( ns /= ns_old ) THEN … … 2875 2764 2876 2765 nc_stat = NF90_GET_VAR( id_set_xz(av), id_var_y_xz(av), netcdf_data ) 2877 CALL handle_netcdf_error( 'netcdf', 172 )2766 CALL netcdf_handle_error( 'netcdf_define_header', 172 ) 2878 2767 2879 2768 DO i = 1, ns … … 2915 2804 !-- on the file. 2916 2805 nc_stat = NF90_INQ_VARID( id_set_xz(av), 'time', id_var_time_xz(av) ) 2917 CALL handle_netcdf_error( 'netcdf', 173 )2806 CALL netcdf_handle_error( 'netcdf_define_header', 173 ) 2918 2807 2919 2808 nc_stat = NF90_INQUIRE_VARIABLE( id_set_xz(av), id_var_time_xz(av), & 2920 2809 dimids = id_dim_time_old ) 2921 CALL handle_netcdf_error( 'netcdf', 174 )2810 CALL netcdf_handle_error( 'netcdf_define_header', 174 ) 2922 2811 id_dim_time_xz(av) = id_dim_time_old(1) 2923 2812 2924 2813 nc_stat = NF90_INQUIRE_DIMENSION( id_set_xz(av), id_dim_time_xz(av), & 2925 2814 len = ntime_count ) 2926 CALL handle_netcdf_error( 'netcdf', 175 )2815 CALL netcdf_handle_error( 'netcdf_define_header', 175 ) 2927 2816 2928 2817 ! … … 2937 2826 start = (/ do2d_xz_time_count(av) /), & 2938 2827 count = (/ 1 /) ) 2939 CALL handle_netcdf_error( 'netcdf', 176 )2828 CALL netcdf_handle_error( 'netcdf_define_header', 176 ) 2940 2829 2941 2830 IF ( last_time_coordinate(1) >= simulated_time ) THEN … … 3008 2897 nc_stat = NF90_INQ_VARID( id_set_xz(av), do2d(av,i), & 3009 2898 id_var_do2d(av,i) ) 3010 CALL handle_netcdf_error( 'netcdf', 177 )2899 CALL netcdf_handle_error( 'netcdf_define_header', 177 ) 3011 2900 #if defined( __netcdf4_parallel ) 3012 2901 ! … … 3032 2921 ! NF90_INDEPENDENT ) 3033 2922 ENDIF 3034 CALL handle_netcdf_error( 'netcdf', 455 )2923 CALL netcdf_handle_error( 'netcdf_define_header', 455 ) 3035 2924 ENDIF 3036 2925 #endif … … 3053 2942 ENDIF 3054 2943 nc_stat = NF90_REDEF( id_set_xz(av) ) 3055 CALL handle_netcdf_error( 'netcdf', 433 )2944 CALL netcdf_handle_error( 'netcdf_define_header', 433 ) 3056 2945 nc_stat = NF90_PUT_ATT( id_set_xz(av), NF90_GLOBAL, 'title', & 3057 2946 TRIM( run_description_header ) // & 3058 2947 TRIM( time_average_text ) ) 3059 CALL handle_netcdf_error( 'netcdf', 178 )2948 CALL netcdf_handle_error( 'netcdf_define_header', 178 ) 3060 2949 nc_stat = NF90_ENDDEF( id_set_xz(av) ) 3061 CALL handle_netcdf_error( 'netcdf', 434 )2950 CALL netcdf_handle_error( 'netcdf_define_header', 434 ) 3062 2951 message_string = 'netCDF file for cross-sections ' // & 3063 2952 TRIM( var ) // ' from previous run found.' // & … … 3072 2961 nc_stat = NF90_PUT_ATT( id_set_yz(av), NF90_GLOBAL, 'Conventions', & 3073 2962 'COARDS' ) 3074 CALL handle_netcdf_error( 'netcdf', 179 )2963 CALL netcdf_handle_error( 'netcdf_define_header', 179 ) 3075 2964 3076 2965 IF ( av == 0 ) THEN … … 3083 2972 TRIM( run_description_header ) // & 3084 2973 TRIM( time_average_text ) ) 3085 CALL handle_netcdf_error( 'netcdf', 180 )2974 CALL netcdf_handle_error( 'netcdf_define_header', 180 ) 3086 2975 IF ( av == 1 ) THEN 3087 2976 WRITE ( time_average_text,'(F7.1,'' s avg'')' ) averaging_interval 3088 2977 nc_stat = NF90_PUT_ATT( id_set_yz(av), NF90_GLOBAL, 'time_avg', & 3089 2978 TRIM( time_average_text ) ) 3090 CALL handle_netcdf_error( 'netcdf', 180 )2979 CALL netcdf_handle_error( 'netcdf_define_header', 180 ) 3091 2980 ENDIF 3092 2981 … … 3096 2985 !-- the performance drops significantly. 3097 2986 IF ( netcdf_data_format < 5 ) THEN 3098 nc_stat = NF90_DEF_DIM( id_set_yz(av), 'time', NF90_UNLIMITED, & 3099 id_dim_time_yz(av) ) 3100 CALL handle_netcdf_error( 'netcdf', 181 ) 2987 CALL netcdf_create_dim( id_set_yz(av), 'time', NF90_UNLIMITED, & 2988 id_dim_time_yz(av), 181 ) 3101 2989 ELSE 3102 nc_stat = NF90_DEF_DIM( id_set_yz(av), 'time', ntdim_2d_yz(av), & 3103 id_dim_time_yz(av) ) 3104 CALL handle_netcdf_error( 'netcdf', 526 ) 3105 ENDIF 3106 3107 nc_stat = NF90_DEF_VAR( id_set_yz(av), 'time', NF90_DOUBLE, & 3108 id_dim_time_yz(av), id_var_time_yz(av) ) 3109 CALL handle_netcdf_error( 'netcdf', 182 ) 3110 3111 nc_stat = NF90_PUT_ATT( id_set_yz(av), id_var_time_yz(av), 'units', & 3112 'seconds') 3113 CALL handle_netcdf_error( 'netcdf', 183 ) 3114 2990 CALL netcdf_create_dim( id_set_yz(av), 'time', ntdim_2d_yz(av), & 2991 id_dim_time_yz(av), 526 ) 2992 ENDIF 2993 2994 CALL netcdf_create_var( id_set_yz(av), (/ id_dim_time_yz(av) /), & 2995 'time', NF90_DOUBLE, id_var_time_yz(av), & 2996 'seconds', '', 182, 183, 000 ) 3115 2997 ! 3116 2998 !-- Define the spatial dimensions and coordinates for yz-sections. … … 3128 3010 ! 3129 3011 !-- Define x axis (for scalar position) 3130 nc_stat = NF90_DEF_DIM( id_set_yz(av), 'x_yz', ns, id_dim_x_yz(av) ) 3131 CALL handle_netcdf_error( 'netcdf', 184 ) 3132 3133 nc_stat = NF90_DEF_VAR( id_set_yz(av), 'x_yz', NF90_DOUBLE, & 3134 id_dim_x_yz(av), id_var_x_yz(av) ) 3135 CALL handle_netcdf_error( 'netcdf', 185 ) 3136 3137 nc_stat = NF90_PUT_ATT( id_set_yz(av), id_var_x_yz(av), 'units', & 3138 'meters' ) 3139 CALL handle_netcdf_error( 'netcdf', 186 ) 3140 3012 CALL netcdf_create_dim( id_set_yz(av), 'x_yz', ns, id_dim_x_yz(av), & 3013 184 ) 3014 CALL netcdf_create_var( id_set_yz(av), (/ id_dim_x_yz(av) /), & 3015 'x_yz', NF90_DOUBLE, id_var_x_yz(av), & 3016 'meters', '', 185, 186, 000 ) 3141 3017 ! 3142 3018 !-- Define x axis (for u position) 3143 nc_stat = NF90_DEF_DIM( id_set_yz(av), 'xu_yz', ns, id_dim_xu_yz(av) ) 3144 CALL handle_netcdf_error( 'netcdf', 377 ) 3145 3146 nc_stat = NF90_DEF_VAR( id_set_yz(av), 'xu_yz', NF90_DOUBLE, & 3147 id_dim_xu_yz(av), id_var_xu_yz(av) ) 3148 CALL handle_netcdf_error( 'netcdf', 378 ) 3149 3150 nc_stat = NF90_PUT_ATT( id_set_yz(av), id_var_xu_yz(av), 'units', & 3151 'meters' ) 3152 CALL handle_netcdf_error( 'netcdf', 379 ) 3153 3019 CALL netcdf_create_dim( id_set_yz(av), 'xu_yz', ns, & 3020 id_dim_xu_yz(av), 377 ) 3021 CALL netcdf_create_var( id_set_yz(av), (/ id_dim_xu_yz(av) /), & 3022 'xu_yz', NF90_DOUBLE, id_var_xu_yz(av), & 3023 'meters', '', 378, 379, 000 ) 3154 3024 ! 3155 3025 !-- Define a variable to store the layer indices of the vertical cross 3156 3026 !-- sections 3157 nc_stat = NF90_DEF_VAR( id_set_yz(av), 'ind_x_yz', NF90_DOUBLE, & 3158 id_dim_x_yz(av), id_var_ind_x_yz(av) ) 3159 CALL handle_netcdf_error( 'netcdf', 187 ) 3160 3161 nc_stat = NF90_PUT_ATT( id_set_yz(av), id_var_ind_x_yz(av), 'units', & 3162 'gridpoints') 3163 CALL handle_netcdf_error( 'netcdf', 188 ) 3164 3027 CALL netcdf_create_var( id_set_yz(av), (/ id_dim_x_yz(av) /), & 3028 'ind_x_yz', NF90_DOUBLE, & 3029 id_var_ind_x_yz(av), 'gridpoints', '', 187, & 3030 188, 000 ) 3165 3031 ! 3166 3032 !-- Define y-axis (for scalar position) 3167 nc_stat = NF90_DEF_DIM( id_set_yz(av), 'y', ny+2, id_dim_y_yz(av) ) 3168 CALL handle_netcdf_error( 'netcdf', 189 ) 3169 3170 nc_stat = NF90_DEF_VAR( id_set_yz(av), 'y', NF90_DOUBLE, & 3171 id_dim_y_yz(av), id_var_y_yz(av) ) 3172 CALL handle_netcdf_error( 'netcdf', 190 ) 3173 3174 nc_stat = NF90_PUT_ATT( id_set_yz(av), id_var_y_yz(av), 'units', & 3175 'meters' ) 3176 CALL handle_netcdf_error( 'netcdf', 191 ) 3177 3033 CALL netcdf_create_dim( id_set_yz(av), 'y', ny+2, id_dim_y_yz(av), & 3034 189 ) 3035 CALL netcdf_create_var( id_set_yz(av), (/ id_dim_y_yz(av) /), 'y', & 3036 NF90_DOUBLE, id_var_y_yz(av), 'meters', '', & 3037 190, 191, 000 ) 3178 3038 ! 3179 3039 !-- Define y-axis (for v position) 3180 nc_stat = NF90_DEF_DIM( id_set_yz(av), 'yv', ny+2, id_dim_yv_yz(av) ) 3181 CALL handle_netcdf_error( 'netcdf', 380 ) 3182 3183 nc_stat = NF90_DEF_VAR( id_set_yz(av), 'yv', NF90_DOUBLE, & 3184 id_dim_yv_yz(av), id_var_yv_yz(av) ) 3185 CALL handle_netcdf_error( 'netcdf', 381 ) 3186 3187 nc_stat = NF90_PUT_ATT( id_set_yz(av), id_var_yv_yz(av), 'units', & 3188 'meters' ) 3189 CALL handle_netcdf_error( 'netcdf', 382 ) 3190 3040 CALL netcdf_create_dim( id_set_yz(av), 'yv', ny+2, id_dim_yv_yz(av), & 3041 380 ) 3042 CALL netcdf_create_var( id_set_yz(av), (/ id_dim_yv_yz(av) /), 'yv', & 3043 NF90_DOUBLE, id_var_yv_yz(av), 'meters', '', & 3044 381, 382, 000 ) 3191 3045 ! 3192 3046 !-- Define the two z-axes (zu and zw) 3193 nc_stat = NF90_DEF_DIM( id_set_yz(av), 'zu', nz+2, id_dim_zu_yz(av) ) 3194 CALL handle_netcdf_error( 'netcdf', 192 ) 3195 3196 nc_stat = NF90_DEF_VAR( id_set_yz(av), 'zu', NF90_DOUBLE, & 3197 id_dim_zu_yz(av), id_var_zu_yz(av) ) 3198 CALL handle_netcdf_error( 'netcdf', 193 ) 3199 3200 nc_stat = NF90_PUT_ATT( id_set_yz(av), id_var_zu_yz(av), 'units', & 3201 'meters' ) 3202 CALL handle_netcdf_error( 'netcdf', 194 ) 3203 3204 nc_stat = NF90_DEF_DIM( id_set_yz(av), 'zw', nz+2, id_dim_zw_yz(av) ) 3205 CALL handle_netcdf_error( 'netcdf', 195 ) 3206 3207 nc_stat = NF90_DEF_VAR( id_set_yz(av), 'zw', NF90_DOUBLE, & 3208 id_dim_zw_yz(av), id_var_zw_yz(av) ) 3209 CALL handle_netcdf_error( 'netcdf', 196 ) 3210 3211 nc_stat = NF90_PUT_ATT( id_set_yz(av), id_var_zw_yz(av), 'units', & 3212 'meters' ) 3213 CALL handle_netcdf_error( 'netcdf', 197 ) 3047 CALL netcdf_create_dim( id_set_yz(av), 'zu', nz+2, id_dim_zu_yz(av), & 3048 192 ) 3049 CALL netcdf_create_var( id_set_yz(av), (/ id_dim_zu_yz(av) /), 'zu', & 3050 NF90_DOUBLE, id_var_zu_yz(av), 'meters', '', & 3051 193, 194, 000 ) 3052 3053 CALL netcdf_create_dim( id_set_yz(av), 'zw', nz+2, id_dim_zw_yz(av), & 3054 195 ) 3055 CALL netcdf_create_var( id_set_yz(av), (/ id_dim_zw_yz(av) /), 'zw', & 3056 NF90_DOUBLE, id_var_zw_yz(av), 'meters', '', & 3057 196, 197, 000 ) 3214 3058 3215 3059 IF ( land_surface ) THEN 3216 3060 3217 nc_stat = NF90_DEF_DIM( id_set_yz(av), 'zs', nzs, id_dim_zs_yz(av) ) 3218 CALL handle_netcdf_error( 'netcdf', 545 ) 3219 3220 nc_stat = NF90_DEF_VAR( id_set_yz(av), 'zs', NF90_DOUBLE, & 3221 id_dim_zs_yz(av), id_var_zs_yz(av) ) 3222 CALL handle_netcdf_error( 'netcdf', 546 ) 3223 3224 nc_stat = NF90_PUT_ATT( id_set_yz(av), id_var_zs_yz(av), 'units', & 3225 'meters' ) 3226 CALL handle_netcdf_error( 'netcdf', 547 ) 3227 3228 ENDIF 3229 3061 CALL netcdf_create_dim( id_set_yz(av), 'zs', nzs, & 3062 id_dim_zs_yz(av), 545 ) 3063 CALL netcdf_create_var( id_set_yz(av), (/ id_dim_zs_yz(av) /), & 3064 'zs', NF90_DOUBLE, id_var_zs_yz(av), & 3065 'meters', '', 546, 547, 000 ) 3066 3067 ENDIF 3230 3068 3231 3069 ! … … 3290 3128 grid_x, grid_y, grid_z ) 3291 3129 3130 IF ( .NOT. found ) THEN 3131 WRITE ( message_string, * ) 'no grid defined for', & 3132 ' variable ', TRIM( do2d(av,i) ) 3133 CALL message( 'define_netcdf_header', 'PA0244', & 3134 0, 1, 0, 6, 0 ) 3135 ENDIF 3136 3292 3137 END SELECT 3293 3138 … … 3316 3161 ! 3317 3162 !-- Define the grid 3318 nc_stat = NF90_DEF_VAR( id_set_yz(av), do2d(av,i), & 3319 nc_precision(3), & 3320 (/ id_x, id_y, id_z, id_dim_time_yz(av) /), & 3321 id_var_do2d(av,i) ) 3322 3323 IF ( .NOT. found ) THEN 3324 WRITE ( message_string, * ) 'no grid defined for', & 3325 ' variable ', TRIM( do2d(av,i) ) 3326 CALL message( 'define_netcdf_header', 'PA0244',& 3327 0, 1, 0, 6, 0 ) 3328 ENDIF 3329 3330 var_list = TRIM( var_list ) // TRIM( do2d(av,i) ) // ';' 3331 3332 CALL handle_netcdf_error( 'netcdf', 198 ) 3333 ! 3334 !-- Store the 'real' name of the variable (with *, for example) 3335 !-- in the long_name attribute. This is evaluated by Ferret, 3336 !-- for example. 3337 nc_stat = NF90_PUT_ATT( id_set_yz(av), id_var_do2d(av,i), & 3338 'long_name', do2d(av,i) ) 3339 CALL handle_netcdf_error( 'netcdf', 199 ) 3340 ! 3341 !-- Define the variable's unit 3342 nc_stat = NF90_PUT_ATT( id_set_yz(av), id_var_do2d(av,i), & 3343 'units', TRIM( do2d_unit(av,i) ) ) 3344 CALL handle_netcdf_error( 'netcdf', 356 ) 3163 CALL netcdf_create_var( id_set_yz(av), (/ id_x, id_y, id_z, & 3164 id_dim_time_yz(av) /), do2d(av,i), & 3165 nc_precision(3), id_var_do2d(av,i), & 3166 TRIM( do2d_unit(av,i) ), do2d(av,i), & 3167 198, 199, 356 ) 3168 3345 3169 #if defined( __netcdf4_parallel ) 3346 3170 IF ( netcdf_data_format > 4 ) THEN … … 3350 3174 id_var_do2d(av,i), & 3351 3175 1, 0 ) 3352 CALL handle_netcdf_error( 'netcdf', 535 )3176 CALL netcdf_handle_error( 'netcdf_define_header', 535 ) 3353 3177 ! 3354 3178 !-- Set independent io operations for parallel io. Collective io … … 3372 3196 ! NF90_INDEPENDENT ) 3373 3197 ENDIF 3374 CALL handle_netcdf_error( 'netcdf', 450 )3198 CALL netcdf_handle_error( 'netcdf_define_header', 450 ) 3375 3199 ENDIF 3376 3200 #endif 3201 var_list = TRIM( var_list ) // TRIM( do2d(av,i) ) // ';' 3202 3377 3203 ENDIF 3378 3204 … … 3390 3216 nc_stat = NF90_PUT_ATT( id_set_yz(av), NF90_GLOBAL, 'VAR_LIST', & 3391 3217 var_list ) 3392 CALL handle_netcdf_error( 'netcdf', 200 )3218 CALL netcdf_handle_error( 'netcdf_define_header', 200 ) 3393 3219 3394 3220 ! … … 3396 3222 !-- parallel output. 3397 3223 nc_stat = NF90_SET_FILL( id_set_yz(av), NF90_NOFILL, oldmode ) 3398 CALL handle_netcdf_error( 'netcdf', 531 )3224 CALL netcdf_handle_error( 'netcdf_define_header', 531 ) 3399 3225 3400 3226 ! 3401 3227 !-- Leave netCDF define mode 3402 3228 nc_stat = NF90_ENDDEF( id_set_yz(av) ) 3403 CALL handle_netcdf_error( 'netcdf', 201 )3229 CALL netcdf_handle_error( 'netcdf_define_header', 201 ) 3404 3230 3405 3231 ! … … 3424 3250 netcdf_data, start = (/ 1 /), & 3425 3251 count = (/ ns /) ) 3426 CALL handle_netcdf_error( 'netcdf', 202 )3252 CALL netcdf_handle_error( 'netcdf_define_header', 202 ) 3427 3253 3428 3254 ! … … 3438 3264 netcdf_data, start = (/ 1 /), & 3439 3265 count = (/ ns /) ) 3440 CALL handle_netcdf_error( 'netcdf', 383 )3266 CALL netcdf_handle_error( 'netcdf_define_header', 383 ) 3441 3267 3442 3268 ! … … 3446 3272 netcdf_data, start = (/ 1 /), & 3447 3273 count = (/ ns /) ) 3448 CALL handle_netcdf_error( 'netcdf', 203 )3274 CALL netcdf_handle_error( 'netcdf_define_header', 203 ) 3449 3275 3450 3276 DEALLOCATE( netcdf_data ) … … 3461 3287 netcdf_data, start = (/ 1 /), & 3462 3288 count = (/ ny+2 /) ) 3463 CALL handle_netcdf_error( 'netcdf', 204 )3289 CALL netcdf_handle_error( 'netcdf_define_header', 204 ) 3464 3290 3465 3291 DO j = 0, ny+1 … … 3470 3296 netcdf_data, start = (/ 1 /), & 3471 3297 count = (/ ny+2 /) ) 3472 CALL handle_netcdf_error( 'netcdf', 384 )3298 CALL netcdf_handle_error( 'netcdf_define_header', 384 ) 3473 3299 3474 3300 DEALLOCATE( netcdf_data ) … … 3482 3308 netcdf_data, start = (/ 1 /), & 3483 3309 count = (/ nz+2 /) ) 3484 CALL handle_netcdf_error( 'netcdf', 205 )3310 CALL netcdf_handle_error( 'netcdf_define_header', 205 ) 3485 3311 3486 3312 netcdf_data(0:nz+1) = zw(nzb:nzt+1) … … 3488 3314 netcdf_data, start = (/ 1 /), & 3489 3315 count = (/ nz+2 /) ) 3490 CALL handle_netcdf_error( 'netcdf', 206 )3316 CALL netcdf_handle_error( 'netcdf_define_header', 206 ) 3491 3317 3492 3318 DEALLOCATE( netcdf_data ) … … 3504 3330 nc_stat = NF90_GET_ATT( id_set_yz(av), NF90_GLOBAL, 'VAR_LIST', & 3505 3331 var_list_old ) 3506 CALL handle_netcdf_error( 'netcdf', 207 )3332 CALL netcdf_handle_error( 'netcdf_define_header', 207 ) 3507 3333 3508 3334 var_list = ';' … … 3543 3369 !-- Get and compare the number of vertical cross sections 3544 3370 nc_stat = NF90_INQ_VARID( id_set_yz(av), 'x_yz', id_var_x_yz(av) ) 3545 CALL handle_netcdf_error( 'netcdf', 208 )3371 CALL netcdf_handle_error( 'netcdf_define_header', 208 ) 3546 3372 3547 3373 nc_stat = NF90_INQUIRE_VARIABLE( id_set_yz(av), id_var_x_yz(av), & 3548 3374 dimids = id_dim_x_yz_old ) 3549 CALL handle_netcdf_error( 'netcdf', 209 )3375 CALL netcdf_handle_error( 'netcdf_define_header', 209 ) 3550 3376 id_dim_x_yz(av) = id_dim_x_yz_old(1) 3551 3377 3552 3378 nc_stat = NF90_INQUIRE_DIMENSION( id_set_yz(av), id_dim_x_yz(av), & 3553 3379 len = ns_old ) 3554 CALL handle_netcdf_error( 'netcdf', 210 )3380 CALL netcdf_handle_error( 'netcdf_define_header', 210 ) 3555 3381 3556 3382 IF ( ns /= ns_old ) THEN … … 3571 3397 3572 3398 nc_stat = NF90_GET_VAR( id_set_yz(av), id_var_x_yz(av), netcdf_data ) 3573 CALL handle_netcdf_error( 'netcdf', 211 )3399 CALL netcdf_handle_error( 'netcdf_define_header', 211 ) 3574 3400 3575 3401 DO i = 1, ns … … 3611 3437 !-- on the file. 3612 3438 nc_stat = NF90_INQ_VARID( id_set_yz(av), 'time', id_var_time_yz(av) ) 3613 CALL handle_netcdf_error( 'netcdf', 212 )3439 CALL netcdf_handle_error( 'netcdf_define_header', 212 ) 3614 3440 3615 3441 nc_stat = NF90_INQUIRE_VARIABLE( id_set_yz(av), id_var_time_yz(av), & 3616 3442 dimids = id_dim_time_old ) 3617 CALL handle_netcdf_error( 'netcdf', 213 )3443 CALL netcdf_handle_error( 'netcdf_define_header', 213 ) 3618 3444 id_dim_time_yz(av) = id_dim_time_old(1) 3619 3445 3620 3446 nc_stat = NF90_INQUIRE_DIMENSION( id_set_yz(av), id_dim_time_yz(av), & 3621 3447 len = ntime_count ) 3622 CALL handle_netcdf_error( 'netcdf', 214 )3448 CALL netcdf_handle_error( 'netcdf_define_header', 214 ) 3623 3449 3624 3450 ! … … 3633 3459 start = (/ do2d_yz_time_count(av) /), & 3634 3460 count = (/ 1 /) ) 3635 CALL handle_netcdf_error( 'netcdf', 215 )3461 CALL netcdf_handle_error( 'netcdf_define_header', 215 ) 3636 3462 3637 3463 IF ( last_time_coordinate(1) >= simulated_time ) THEN … … 3704 3530 nc_stat = NF90_INQ_VARID( id_set_yz(av), do2d(av,i), & 3705 3531 id_var_do2d(av,i) ) 3706 CALL handle_netcdf_error( 'netcdf', 216 )3532 CALL netcdf_handle_error( 'netcdf_define_header', 216 ) 3707 3533 #if defined( __netcdf4_parallel ) 3708 3534 ! … … 3728 3554 ! NF90_INDEPENDENT ) 3729 3555 ENDIF 3730 CALL handle_netcdf_error( 'netcdf', 450 )3556 CALL netcdf_handle_error( 'netcdf_define_header', 450 ) 3731 3557 ENDIF 3732 3558 #endif … … 3749 3575 ENDIF 3750 3576 nc_stat = NF90_REDEF( id_set_yz(av) ) 3751 CALL handle_netcdf_error( 'netcdf', 435 )3577 CALL netcdf_handle_error( 'netcdf_define_header', 435 ) 3752 3578 nc_stat = NF90_PUT_ATT( id_set_yz(av), NF90_GLOBAL, 'title', & 3753 3579 TRIM( run_description_header ) // & 3754 3580 TRIM( time_average_text ) ) 3755 CALL handle_netcdf_error( 'netcdf', 217 )3581 CALL netcdf_handle_error( 'netcdf_define_header', 217 ) 3756 3582 nc_stat = NF90_ENDDEF( id_set_yz(av) ) 3757 CALL handle_netcdf_error( 'netcdf', 436 )3583 CALL netcdf_handle_error( 'netcdf_define_header', 436 ) 3758 3584 message_string = 'netCDF file for cross-sections ' // & 3759 3585 TRIM( var ) // ' from previous run found.' // & … … 3772 3598 TRIM( run_description_header ) // & 3773 3599 TRIM( time_average_text ) ) 3774 CALL handle_netcdf_error( 'netcdf', 218 )3600 CALL netcdf_handle_error( 'netcdf_define_header', 218 ) 3775 3601 3776 3602 WRITE ( time_average_text,'(F7.1,'' s avg'')' ) averaging_interval_pr … … 3781 3607 TRIM( run_description_header ) ) 3782 3608 ENDIF 3783 CALL handle_netcdf_error( 'netcdf', 219 )3609 CALL netcdf_handle_error( 'netcdf_define_header', 219 ) 3784 3610 3785 3611 ! … … 3790 3616 'no_rows', & 3791 3617 profile_rows ) 3792 CALL handle_netcdf_error( 'netcdf', 519 )3618 CALL netcdf_handle_error( 'netcdf_define_header', 519 ) 3793 3619 3794 3620 nc_stat = NF90_PUT_ATT( id_set_pr, NF90_GLOBAL, & 3795 3621 'no_columns', & 3796 3622 profile_columns ) 3797 CALL handle_netcdf_error( 'netcdf', 520 )3623 CALL netcdf_handle_error( 'netcdf_define_header', 520 ) 3798 3624 3799 3625 … … 3831 3657 !-- Check if all profiles defined in cross_profiles are defined in 3832 3658 !-- data_output_pr. If not, they will be skipped. 3833 3834 3659 DO i = 1, cross_profiles_count 3835 3660 DO j = 1, dopr_n … … 3869 3694 !-- Check if all profiles defined in data_output_pr are defined in 3870 3695 !-- cross_profiles. If not, they will be added to cross_profiles. 3871 3872 3696 DO i = 1, dopr_n 3873 3697 DO j = 1, cross_profiles_count … … 3929 3753 nc_stat = NF90_PUT_ATT( id_set_pr, NF90_GLOBAL, 'cross_profiles', & 3930 3754 TRIM( char_cross_profiles ) ) 3931 CALL handle_netcdf_error( 'netcdf', 521 )3755 CALL netcdf_handle_error( 'netcdf_define_header', 521 ) 3932 3756 3933 3757 ! 3934 3758 !-- Define time coordinate for profiles (unlimited dimension) 3935 nc_stat = NF90_DEF_DIM( id_set_pr, 'time', NF90_UNLIMITED, & 3936 id_dim_time_pr ) 3937 CALL handle_netcdf_error( 'netcdf', 220 ) 3938 3939 nc_stat = NF90_DEF_VAR( id_set_pr, 'time', NF90_DOUBLE, & 3940 id_dim_time_pr, id_var_time_pr ) 3941 CALL handle_netcdf_error( 'netcdf', 221 ) 3942 3943 nc_stat = NF90_PUT_ATT( id_set_pr, id_var_time_pr, 'units', 'seconds') 3944 CALL handle_netcdf_error( 'netcdf', 222 ) 3945 3759 CALL netcdf_create_dim( id_set_pr, 'time', NF90_UNLIMITED, & 3760 id_dim_time_pr, 220 ) 3761 CALL netcdf_create_var( id_set_pr, (/ id_dim_time_pr /), 'time', & 3762 NF90_DOUBLE, id_var_time_pr, 'seconds', '', & 3763 221, 222, 000 ) 3946 3764 ! 3947 3765 !-- Define the variables … … 3953 3771 ! 3954 3772 !-- Define the z-axes (each variable gets its own z-axis) 3955 nc_stat = NF90_DEF_DIM( id_set_pr, & 3956 'z' // TRIM( data_output_pr(i) ), & 3957 nzt+2-nzb, id_dim_z_pr(i,0) ) 3958 CALL handle_netcdf_error( 'netcdf', 223 ) 3959 3960 nc_stat = NF90_DEF_VAR( id_set_pr, & 3961 'z' // TRIM( data_output_pr(i) ), & 3962 NF90_DOUBLE, id_dim_z_pr(i,0), & 3963 id_var_z_pr(i,0) ) 3964 CALL handle_netcdf_error( 'netcdf', 224 ) 3965 3966 nc_stat = NF90_PUT_ATT( id_set_pr, id_var_z_pr(i,0), 'units', & 3967 'meters' ) 3968 CALL handle_netcdf_error( 'netcdf', 225 ) 3773 CALL netcdf_create_dim( id_set_pr, & 3774 'z' // TRIM( data_output_pr(i) ), & 3775 nzt+2-nzb, id_dim_z_pr(i,0), 223 ) 3776 CALL netcdf_create_var( id_set_pr, (/ id_dim_z_pr(i,0) /), & 3777 'z' // TRIM( data_output_pr(i) ), & 3778 NF90_DOUBLE, id_var_z_pr(i,0), & 3779 'meters', '', 224, 225, 000 ) 3969 3780 ! 3970 3781 !-- Define the variable 3971 nc_stat = NF90_DEF_VAR( id_set_pr, data_output_pr(i), & 3972 nc_precision(5), (/ id_dim_z_pr(i,0), & 3973 id_dim_time_pr /), id_var_dopr(i,0) ) 3974 CALL handle_netcdf_error( 'netcdf', 226 ) 3975 3976 nc_stat = NF90_PUT_ATT( id_set_pr, id_var_dopr(i,0), & 3977 'long_name', TRIM( data_output_pr(i) ) ) 3978 CALL handle_netcdf_error( 'netcdf', 227 ) 3979 3980 nc_stat = NF90_PUT_ATT( id_set_pr, id_var_dopr(i,0), & 3981 'units', TRIM( dopr_unit(i) ) ) 3982 CALL handle_netcdf_error( 'netcdf', 228 ) 3782 CALL netcdf_create_var( id_set_pr, (/ id_dim_z_pr(i,0), & 3783 id_dim_time_pr /), data_output_pr(i), & 3784 nc_precision(5), id_var_dopr(i,0), & 3785 TRIM( dopr_unit(i) ), & 3786 TRIM( data_output_pr(i) ), 226, 227, & 3787 228 ) 3983 3788 3984 3789 var_list = TRIM( var_list ) // TRIM( data_output_pr(i) ) // ';' … … 3993 3798 ! 3994 3799 !-- Define the z-axes (each variable gets it own z-axis) 3995 nc_stat = NF90_DEF_DIM( id_set_pr, & 3996 'z'//TRIM(data_output_pr(i))//suffix, & 3997 nzt+2-nzb, id_dim_z_pr(i,j) ) 3998 CALL handle_netcdf_error( 'netcdf', 229 ) 3999 4000 nc_stat = NF90_DEF_VAR( id_set_pr, & 4001 'z'//TRIM(data_output_pr(i))//suffix, & 4002 nc_precision(5), id_dim_z_pr(i,j), & 4003 id_var_z_pr(i,j) ) 4004 CALL handle_netcdf_error( 'netcdf', 230 ) 4005 4006 nc_stat = NF90_PUT_ATT( id_set_pr, id_var_z_pr(i,j), & 4007 'units', 'meters' ) 4008 CALL handle_netcdf_error( 'netcdf', 231 ) 4009 3800 CALL netcdf_create_dim( id_set_pr, 'z' // & 3801 TRIM(data_output_pr(i)) // suffix, & 3802 nzt+2-nzb, id_dim_z_pr(i,j), 229 ) 3803 CALL netcdf_create_var( id_set_pr, (/ id_dim_z_pr(i,j) /), & 3804 'z' // TRIM(data_output_pr(i)) // & 3805 suffix, NF90_DOUBLE, & 3806 id_var_z_pr(i,j), 'meters', '', & 3807 230, 231, 000 ) 4010 3808 ! 4011 3809 !-- Define the variable 4012 nc_stat = NF90_DEF_VAR( id_set_pr, & 4013 TRIM(data_output_pr(i)) // suffix, & 4014 nc_precision(5), & 4015 (/ id_dim_z_pr(i,j), & 4016 id_dim_time_pr /), id_var_dopr(i,j) ) 4017 CALL handle_netcdf_error( 'netcdf', 232 ) 4018 4019 nc_stat = NF90_PUT_ATT( id_set_pr, id_var_dopr(i,j), & 4020 'long_name', & 4021 TRIM( data_output_pr(i) ) // ' SR ' & 4022 // suffix(2:2) ) 4023 CALL handle_netcdf_error( 'netcdf', 233 ) 4024 4025 nc_stat = NF90_PUT_ATT( id_set_pr, id_var_dopr(i,j), & 4026 'units', TRIM( dopr_unit(i) ) ) 4027 CALL handle_netcdf_error( 'netcdf', 234 ) 3810 CALL netcdf_create_var( id_set_pr, (/ id_dim_z_pr(i,j), & 3811 id_dim_time_pr /), & 3812 TRIM(data_output_pr(i)) // suffix, & 3813 nc_precision(5), id_var_dopr(i,j), & 3814 TRIM( dopr_unit(i) ), & 3815 TRIM( data_output_pr(i) ) // & 3816 ' SR ', 232, 233, 234 ) 4028 3817 4029 3818 var_list = TRIM( var_list ) // TRIM( data_output_pr(i) ) // & … … 4040 3829 !-- restart runs) 4041 3830 nc_stat = NF90_PUT_ATT( id_set_pr, NF90_GLOBAL, 'VAR_LIST', var_list ) 4042 CALL handle_netcdf_error( 'netcdf', 235 )3831 CALL netcdf_handle_error( 'netcdf_define_header', 235 ) 4043 3832 4044 3833 ! … … 4046 3835 DO i = 1, dopr_norm_num 4047 3836 4048 nc_stat = NF90_DEF_VAR( id_set_pr, 'NORM_' // & 4049 TRIM( dopr_norm_names(i) ), & 4050 nc_precision(5), (/ id_dim_time_pr /), & 4051 id_var_norm_dopr(i) ) 4052 CALL handle_netcdf_error( 'netcdf', 236 ) 4053 4054 nc_stat = NF90_PUT_ATT( id_set_pr, id_var_norm_dopr(i), & 4055 'long_name', & 4056 TRIM( dopr_norm_longnames(i) ) ) 4057 CALL handle_netcdf_error( 'netcdf', 237 ) 3837 CALL netcdf_create_var( id_set_pr, (/ id_dim_time_pr /), & 3838 'NORM_' // TRIM( dopr_norm_names(i) ), & 3839 nc_precision(5), id_var_norm_dopr(i), & 3840 '', TRIM( dopr_norm_longnames(i) ), 236, & 3841 000, 237 ) 4058 3842 4059 3843 ENDDO … … 4062 3846 !-- Leave netCDF define mode 4063 3847 nc_stat = NF90_ENDDEF( id_set_pr ) 4064 CALL handle_netcdf_error( 'netcdf', 238 )3848 CALL netcdf_handle_error( 'netcdf_define_header', 238 ) 4065 3849 4066 3850 ! … … 4073 3857 start = (/ 1 /), & 4074 3858 count = (/ nzt-nzb+2 /) ) 4075 CALL handle_netcdf_error( 'netcdf', 239 )3859 CALL netcdf_handle_error( 'netcdf_define_header', 239 ) 4076 3860 4077 3861 ENDDO … … 4088 3872 nc_stat = NF90_GET_ATT( id_set_pr, NF90_GLOBAL, 'VAR_LIST', & 4089 3873 var_list_old ) 4090 CALL handle_netcdf_error( 'netcdf', 240 )3874 CALL netcdf_handle_error( 'netcdf_define_header', 240 ) 4091 3875 4092 3876 var_list = ';' … … 4122 3906 !-- on the file. 4123 3907 nc_stat = NF90_INQ_VARID( id_set_pr, 'time', id_var_time_pr ) 4124 CALL handle_netcdf_error( 'netcdf', 241 )3908 CALL netcdf_handle_error( 'netcdf_define_header', 241 ) 4125 3909 4126 3910 nc_stat = NF90_INQUIRE_VARIABLE( id_set_pr, id_var_time_pr, & 4127 3911 dimids = id_dim_time_old ) 4128 CALL handle_netcdf_error( 'netcdf', 242 )3912 CALL netcdf_handle_error( 'netcdf_define_header', 242 ) 4129 3913 id_dim_time_pr = id_dim_time_old(1) 4130 3914 4131 3915 nc_stat = NF90_INQUIRE_DIMENSION( id_set_pr, id_dim_time_pr, & 4132 3916 len = dopr_time_count ) 4133 CALL handle_netcdf_error( 'netcdf', 243 )3917 CALL netcdf_handle_error( 'netcdf_define_header', 243 ) 4134 3918 4135 3919 nc_stat = NF90_GET_VAR( id_set_pr, id_var_time_pr, & … … 4137 3921 start = (/ dopr_time_count /), & 4138 3922 count = (/ 1 /) ) 4139 CALL handle_netcdf_error( 'netcdf', 244 )3923 CALL netcdf_handle_error( 'netcdf_define_header', 244 ) 4140 3924 4141 3925 IF ( last_time_coordinate(1) >= simulated_time ) THEN … … 4162 3946 nc_stat = NF90_INQ_VARID( id_set_pr, data_output_pr(i), & 4163 3947 id_var_dopr(i,0) ) 4164 CALL handle_netcdf_error( 'netcdf', 245 )3948 CALL netcdf_handle_error( 'netcdf_define_header', 245 ) 4165 3949 ELSE 4166 3950 DO j = 0, statistic_regions … … 4169 3953 nc_stat = NF90_INQ_VARID( id_set_pr, netcdf_var_name, & 4170 3954 id_var_dopr(i,j) ) 4171 CALL handle_netcdf_error( 'netcdf', 246 )3955 CALL netcdf_handle_error( 'netcdf_define_header', 246 ) 4172 3956 ENDDO 4173 3957 ENDIF … … 4181 3965 'NORM_' // TRIM( dopr_norm_names(i) ), & 4182 3966 id_var_norm_dopr(i) ) 4183 CALL handle_netcdf_error( 'netcdf', 247 )3967 CALL netcdf_handle_error( 'netcdf_define_header', 247 ) 4184 3968 ENDDO 4185 3969 … … 4198 3982 ENDIF 4199 3983 nc_stat = NF90_REDEF( id_set_pr ) 4200 CALL handle_netcdf_error( 'netcdf', 437 )3984 CALL netcdf_handle_error( 'netcdf_define_header', 437 ) 4201 3985 nc_stat = NF90_PUT_ATT( id_set_pr, NF90_GLOBAL, 'title', & 4202 3986 TRIM( run_description_header ) // & 4203 3987 TRIM( time_average_text ) ) 4204 CALL handle_netcdf_error( 'netcdf', 248 )3988 CALL netcdf_handle_error( 'netcdf_define_header', 248 ) 4205 3989 4206 3990 nc_stat = NF90_ENDDEF( id_set_pr ) 4207 CALL handle_netcdf_error( 'netcdf', 438 )3991 CALL netcdf_handle_error( 'netcdf_define_header', 438 ) 4208 3992 message_string = 'netCDF file for vertical profiles ' // & 4209 3993 'from previous run found.' // & … … 4218 4002 nc_stat = NF90_PUT_ATT( id_set_ts, NF90_GLOBAL, 'title', & 4219 4003 TRIM( run_description_header ) ) 4220 CALL handle_netcdf_error( 'netcdf', 249 )4004 CALL netcdf_handle_error( 'netcdf_define_header', 249 ) 4221 4005 4222 4006 ! 4223 4007 !-- Define time coordinate for time series (unlimited dimension) 4224 nc_stat = NF90_DEF_DIM( id_set_ts, 'time', NF90_UNLIMITED, & 4225 id_dim_time_ts ) 4226 CALL handle_netcdf_error( 'netcdf', 250 ) 4227 4228 nc_stat = NF90_DEF_VAR( id_set_ts, 'time', NF90_DOUBLE, & 4229 id_dim_time_ts, id_var_time_ts ) 4230 CALL handle_netcdf_error( 'netcdf', 251 ) 4231 4232 nc_stat = NF90_PUT_ATT( id_set_ts, id_var_time_ts, 'units', 'seconds') 4233 CALL handle_netcdf_error( 'netcdf', 252 ) 4234 4008 CALL netcdf_create_dim( id_set_ts, 'time', NF90_UNLIMITED, & 4009 id_dim_time_ts, 250 ) 4010 CALL netcdf_create_var( id_set_ts, (/ id_dim_time_ts /), 'time', & 4011 NF90_DOUBLE, id_var_time_ts, 'seconds', '', & 4012 251, 252, 000 ) 4235 4013 ! 4236 4014 !-- Define the variables … … 4240 4018 IF ( statistic_regions == 0 ) THEN 4241 4019 4242 nc_stat = NF90_DEF_VAR( id_set_ts, dots_label(i), & 4243 nc_precision(6), (/ id_dim_time_ts /), & 4244 id_var_dots(i,0) ) 4245 CALL handle_netcdf_error( 'netcdf', 253 ) 4246 4247 nc_stat = NF90_PUT_ATT( id_set_ts, id_var_dots(i,0), & 4248 'long_name', TRIM( dots_label(i) ) ) 4249 CALL handle_netcdf_error( 'netcdf', 254 ) 4250 4251 nc_stat = NF90_PUT_ATT( id_set_ts, id_var_dots(i,0), & 4252 'units', TRIM( dots_unit(i) ) ) 4253 CALL handle_netcdf_error( 'netcdf', 255 ) 4254 4255 var_list = TRIM( var_list ) // TRIM( dots_label(i) ) // ';' 4020 CALL netcdf_create_var( id_set_ts, (/ id_dim_time_ts /), & 4021 dots_label(i), nc_precision(6), & 4022 id_var_dots(i,0), & 4023 TRIM( dots_unit(i) ), & 4024 TRIM( dots_label(i) ), 253, 254, 255 ) 4256 4025 4257 4026 ELSE … … 4262 4031 WRITE ( suffix, '(''_'',I1)' ) j 4263 4032 4264 nc_stat = NF90_DEF_VAR( id_set_ts, & 4265 TRIM( dots_label(i) ) // suffix, & 4266 nc_precision(6), & 4267 (/ id_dim_time_ts /), & 4268 id_var_dots(i,j) ) 4269 CALL handle_netcdf_error( 'netcdf', 256 ) 4270 4271 nc_stat = NF90_PUT_ATT( id_set_ts, id_var_dots(i,j), & 4272 'long_name', & 4273 TRIM( dots_label(i) ) // ' SR ' // & 4274 suffix(2:2) ) 4275 CALL handle_netcdf_error( 'netcdf', 257 ) 4276 4277 nc_stat = NF90_PUT_ATT( id_set_ts, id_var_dots(i,j), & 4278 'units', TRIM( dots_unit(i) ) ) 4279 CALL handle_netcdf_error( 'netcdf', 347 ) 4280 4281 var_list = TRIM( var_list ) // TRIM( dots_label(i) ) // & 4282 suffix // ';' 4033 CALL netcdf_create_var( id_set_ts, (/ id_dim_time_ts /), & 4034 TRIM( dots_label(i) ) // suffix, & 4035 nc_precision(6), id_var_dots(i,j), & 4036 TRIM( dots_unit(i) ), & 4037 TRIM( dots_label(i) ) // ' SR ' // & 4038 suffix(2:2), 256, 257, 347) 4283 4039 4284 4040 ENDDO … … 4292 4048 !-- restart runs) 4293 4049 nc_stat = NF90_PUT_ATT( id_set_ts, NF90_GLOBAL, 'VAR_LIST', var_list ) 4294 CALL handle_netcdf_error( 'netcdf', 258 )4050 CALL netcdf_handle_error( 'netcdf_define_header', 258 ) 4295 4051 4296 4052 ! 4297 4053 !-- Leave netCDF define mode 4298 4054 nc_stat = NF90_ENDDEF( id_set_ts ) 4299 CALL handle_netcdf_error( 'netcdf', 259 )4055 CALL netcdf_handle_error( 'netcdf_define_header', 259 ) 4300 4056 4301 4057 … … 4309 4065 nc_stat = NF90_GET_ATT( id_set_ts, NF90_GLOBAL, 'VAR_LIST', & 4310 4066 var_list_old ) 4311 CALL handle_netcdf_error( 'netcdf', 260 )4067 CALL netcdf_handle_error( 'netcdf_define_header', 260 ) 4312 4068 4313 4069 var_list = ';' … … 4344 4100 !-- on the file. 4345 4101 nc_stat = NF90_INQ_VARID( id_set_ts, 'time', id_var_time_ts ) 4346 CALL handle_netcdf_error( 'netcdf', 261 )4102 CALL netcdf_handle_error( 'netcdf_define_header', 261 ) 4347 4103 4348 4104 nc_stat = NF90_INQUIRE_VARIABLE( id_set_ts, id_var_time_ts, & 4349 4105 dimids = id_dim_time_old ) 4350 CALL handle_netcdf_error( 'netcdf', 262 )4106 CALL netcdf_handle_error( 'netcdf_define_header', 262 ) 4351 4107 id_dim_time_ts = id_dim_time_old(1) 4352 4108 4353 4109 nc_stat = NF90_INQUIRE_DIMENSION( id_set_ts, id_dim_time_ts, & 4354 4110 len = dots_time_count ) 4355 CALL handle_netcdf_error( 'netcdf', 263 )4111 CALL netcdf_handle_error( 'netcdf_define_header', 263 ) 4356 4112 4357 4113 nc_stat = NF90_GET_VAR( id_set_ts, id_var_time_ts, & … … 4359 4115 start = (/ dots_time_count /), & 4360 4116 count = (/ 1 /) ) 4361 CALL handle_netcdf_error( 'netcdf', 264 )4117 CALL netcdf_handle_error( 'netcdf_define_header', 264 ) 4362 4118 4363 4119 IF ( last_time_coordinate(1) >= simulated_time ) THEN … … 4384 4140 nc_stat = NF90_INQ_VARID( id_set_ts, dots_label(i), & 4385 4141 id_var_dots(i,0) ) 4386 CALL handle_netcdf_error( 'netcdf', 265 )4142 CALL netcdf_handle_error( 'netcdf_define_header', 265 ) 4387 4143 ELSE 4388 4144 DO j = 0, statistic_regions … … 4391 4147 nc_stat = NF90_INQ_VARID( id_set_ts, netcdf_var_name, & 4392 4148 id_var_dots(i,j) ) 4393 CALL handle_netcdf_error( 'netcdf', 266 )4149 CALL netcdf_handle_error( 'netcdf_define_header', 266 ) 4394 4150 ENDDO 4395 4151 ENDIF … … 4405 4161 !-- to ensure equal attribute size in a job chain. Maybe revise later. 4406 4162 nc_stat = NF90_REDEF( id_set_ts ) 4407 CALL handle_netcdf_error( 'netcdf', 439 )4163 CALL netcdf_handle_error( 'netcdf_define_header', 439 ) 4408 4164 nc_stat = NF90_PUT_ATT( id_set_ts, NF90_GLOBAL, 'title', & 4409 4165 TRIM( run_description_header ) ) 4410 CALL handle_netcdf_error( 'netcdf', 267 )4166 CALL netcdf_handle_error( 'netcdf_define_header', 267 ) 4411 4167 nc_stat = NF90_ENDDEF( id_set_ts ) 4412 CALL handle_netcdf_error( 'netcdf', 440 )4168 CALL netcdf_handle_error( 'netcdf_define_header', 440 ) 4413 4169 message_string = 'netCDF file for time series ' // & 4414 4170 'from previous run found.' // & … … 4427 4183 TRIM( run_description_header ) // & 4428 4184 TRIM( time_average_text ) ) 4429 CALL handle_netcdf_error( 'netcdf', 268 )4185 CALL netcdf_handle_error( 'netcdf_define_header', 268 ) 4430 4186 4431 4187 WRITE ( time_average_text,'(F7.1,'' s avg'')' ) averaging_interval_sp … … 4436 4192 TRIM( run_description_header ) ) 4437 4193 ENDIF 4438 CALL handle_netcdf_error( 'netcdf', 269 )4194 CALL netcdf_handle_error( 'netcdf_define_header', 269 ) 4439 4195 4440 4196 ! 4441 4197 !-- Define time coordinate for spectra (unlimited dimension) 4442 nc_stat = NF90_DEF_DIM( id_set_sp, 'time', NF90_UNLIMITED, & 4443 id_dim_time_sp ) 4444 CALL handle_netcdf_error( 'netcdf', 270 ) 4445 4446 nc_stat = NF90_DEF_VAR( id_set_sp, 'time', NF90_DOUBLE, & 4447 id_dim_time_sp, id_var_time_sp ) 4448 CALL handle_netcdf_error( 'netcdf', 271 ) 4449 4450 nc_stat = NF90_PUT_ATT( id_set_sp, id_var_time_sp, 'units', 'seconds') 4451 CALL handle_netcdf_error( 'netcdf', 272 ) 4452 4198 CALL netcdf_create_dim( id_set_sp, 'time', NF90_UNLIMITED, & 4199 id_dim_time_sp, 270 ) 4200 CALL netcdf_create_var( id_set_sp, (/ id_dim_time_sp /), 'time', & 4201 NF90_DOUBLE, id_var_time_sp, 'seconds', '', & 4202 271, 272, 000 ) 4453 4203 ! 4454 4204 !-- Define the spatial dimensions and coordinates for spectra. … … 4463 4213 ! 4464 4214 !-- Define vertical coordinate grid (zu grid) 4465 nc_stat = NF90_DEF_DIM( id_set_sp, 'zu_sp', ns, id_dim_zu_sp ) 4466 CALL handle_netcdf_error( 'netcdf', 273 ) 4467 4468 nc_stat = NF90_DEF_VAR( id_set_sp, 'zu_sp', NF90_DOUBLE, & 4469 id_dim_zu_sp, id_var_zu_sp ) 4470 CALL handle_netcdf_error( 'netcdf', 274 ) 4471 4472 nc_stat = NF90_PUT_ATT( id_set_sp, id_var_zu_sp, 'units', 'meters' ) 4473 CALL handle_netcdf_error( 'netcdf', 275 ) 4474 4215 CALL netcdf_create_dim( id_set_sp, 'zu_sp', ns, id_dim_zu_sp, 273 ) 4216 CALL netcdf_create_var( id_set_sp, (/ id_dim_zu_sp /), 'zu_sp', & 4217 NF90_DOUBLE, id_var_zu_sp, 'meters', '', & 4218 274, 275, 000 ) 4475 4219 ! 4476 4220 !-- Define vertical coordinate grid (zw grid) 4477 nc_stat = NF90_DEF_DIM( id_set_sp, 'zw_sp', ns, id_dim_zw_sp ) 4478 CALL handle_netcdf_error( 'netcdf', 276 ) 4479 4480 nc_stat = NF90_DEF_VAR( id_set_sp, 'zw_sp', NF90_DOUBLE, & 4481 id_dim_zw_sp, id_var_zw_sp ) 4482 CALL handle_netcdf_error( 'netcdf', 277 ) 4483 4484 nc_stat = NF90_PUT_ATT( id_set_sp, id_var_zw_sp, 'units', 'meters' ) 4485 CALL handle_netcdf_error( 'netcdf', 278 ) 4486 4221 CALL netcdf_create_dim( id_set_sp, 'zw_sp', ns, id_dim_zw_sp, 276 ) 4222 CALL netcdf_create_var( id_set_sp, (/ id_dim_zw_sp /), 'zw_sp', & 4223 NF90_DOUBLE, id_var_zw_sp, 'meters', '', & 4224 277, 278, 000 ) 4487 4225 ! 4488 4226 !-- Define x-axis 4489 nc_stat = NF90_DEF_DIM( id_set_sp, 'k_x', nx/2, id_dim_x_sp ) 4490 CALL handle_netcdf_error( 'netcdf', 279 ) 4491 4492 nc_stat = NF90_DEF_VAR( id_set_sp, 'k_x', NF90_DOUBLE, id_dim_x_sp, & 4493 id_var_x_sp ) 4494 CALL handle_netcdf_error( 'netcdf', 280 ) 4495 4496 nc_stat = NF90_PUT_ATT( id_set_sp, id_var_x_sp, 'units', 'm-1' ) 4497 CALL handle_netcdf_error( 'netcdf', 281 ) 4498 4227 CALL netcdf_create_dim( id_set_sp, 'k_x', nx/2, id_dim_x_sp, 279 ) 4228 CALL netcdf_create_var( id_set_sp, (/ id_dim_x_sp /), 'k_x', & 4229 NF90_DOUBLE, id_var_x_sp, 'm-1', '', 280, & 4230 281, 000 ) 4499 4231 ! 4500 4232 !-- Define y-axis 4501 nc_stat = NF90_DEF_DIM( id_set_sp, 'k_y', ny/2, id_dim_y_sp ) 4502 CALL handle_netcdf_error( 'netcdf', 282 ) 4503 4504 nc_stat = NF90_DEF_VAR( id_set_sp, 'k_y', NF90_DOUBLE, id_dim_y_sp, & 4505 id_var_y_sp ) 4506 CALL handle_netcdf_error( 'netcdf', 283 ) 4507 4508 nc_stat = NF90_PUT_ATT( id_set_sp, id_var_y_sp, 'units', 'm-1' ) 4509 CALL handle_netcdf_error( 'netcdf', 284 ) 4510 4233 CALL netcdf_create_dim(id_set_sp, 'k_y', ny/2, id_dim_y_sp, 282 ) 4234 CALL netcdf_create_var( id_set_sp, (/ id_dim_y_sp /), 'k_y', & 4235 NF90_DOUBLE, id_var_y_sp, 'm-1', '', 283, & 4236 284, 000 ) 4511 4237 ! 4512 4238 !-- Define the variables … … 4546 4272 netcdf_var_name = TRIM( data_output_sp(i) ) // '_x' 4547 4273 IF ( TRIM( grid_z ) == 'zw' ) THEN 4548 nc_stat = NF90_DEF_VAR( id_set_sp, netcdf_var_name, & 4549 nc_precision(7), (/ id_dim_x_sp, & 4550 id_dim_zw_sp, id_dim_time_sp /), & 4551 id_var_dospx(i) ) 4274 CALL netcdf_create_var( id_set_sp, (/ id_dim_x_sp, & 4275 id_dim_zw_sp, id_dim_time_sp /), & 4276 netcdf_var_name, nc_precision(7), & 4277 id_var_dospx(i), 'unknown', & 4278 netcdf_var_name, 285, 286, 287 ) 4552 4279 ELSE 4553 nc_stat = NF90_DEF_VAR( id_set_sp, netcdf_var_name, & 4554 nc_precision(7), (/ id_dim_x_sp, & 4555 id_dim_zu_sp, id_dim_time_sp /), & 4556 id_var_dospx(i) ) 4280 CALL netcdf_create_var( id_set_sp, (/ id_dim_x_sp, & 4281 id_dim_zu_sp, id_dim_time_sp /), & 4282 netcdf_var_name, nc_precision(7), & 4283 id_var_dospx(i), 'unknown', & 4284 netcdf_var_name, 285, 286, 287 ) 4557 4285 ENDIF 4558 CALL handle_netcdf_error( 'netcdf', 285 )4559 4560 nc_stat = NF90_PUT_ATT( id_set_sp, id_var_dospx(i), &4561 'long_name', netcdf_var_name )4562 CALL handle_netcdf_error( 'netcdf', 286 )4563 4564 nc_stat = NF90_PUT_ATT( id_set_sp, id_var_dospx(i), &4565 'units', 'unknown' )4566 CALL handle_netcdf_error( 'netcdf', 287 )4567 4286 4568 4287 var_list = TRIM( var_list ) // TRIM( netcdf_var_name ) // ';' … … 4576 4295 netcdf_var_name = TRIM( data_output_sp(i) ) // '_y' 4577 4296 IF ( TRIM( grid_z ) == 'zw' ) THEN 4578 nc_stat = NF90_DEF_VAR( id_set_sp, netcdf_var_name, & 4579 nc_precision(7), (/ id_dim_y_sp, & 4580 id_dim_zw_sp, id_dim_time_sp /), & 4581 id_var_dospy(i) ) 4297 CALL netcdf_create_var( id_set_sp, (/ id_dim_y_sp, & 4298 id_dim_zw_sp, id_dim_time_sp /), & 4299 netcdf_var_name, nc_precision(7), & 4300 id_var_dospy(i), 'unknown', & 4301 netcdf_var_name, 288, 289, 290 ) 4582 4302 ELSE 4583 nc_stat = NF90_DEF_VAR( id_set_sp, netcdf_var_name, & 4584 nc_precision(7), (/ id_dim_y_sp, & 4585 id_dim_zu_sp, id_dim_time_sp /), & 4586 id_var_dospy(i) ) 4303 CALL netcdf_create_var( id_set_sp, (/ id_dim_y_sp, & 4304 id_dim_zu_sp, id_dim_time_sp /), & 4305 netcdf_var_name, nc_precision(7), & 4306 id_var_dospy(i), 'unknown', & 4307 netcdf_var_name, 288, 289, 290 ) 4587 4308 ENDIF 4588 CALL handle_netcdf_error( 'netcdf', 288 )4589 4590 nc_stat = NF90_PUT_ATT( id_set_sp, id_var_dospy(i), &4591 'long_name', netcdf_var_name )4592 CALL handle_netcdf_error( 'netcdf', 289 )4593 4594 nc_stat = NF90_PUT_ATT( id_set_sp, id_var_dospy(i), &4595 'units', 'unknown' )4596 CALL handle_netcdf_error( 'netcdf', 290 )4597 4309 4598 4310 var_list = TRIM( var_list ) // TRIM( netcdf_var_name ) // ';' … … 4608 4320 !-- restart runs) 4609 4321 nc_stat = NF90_PUT_ATT( id_set_sp, NF90_GLOBAL, 'VAR_LIST', var_list ) 4610 CALL handle_netcdf_error( 'netcdf', 291 )4322 CALL netcdf_handle_error( 'netcdf_define_header', 291 ) 4611 4323 4612 4324 ! 4613 4325 !-- Leave netCDF define mode 4614 4326 nc_stat = NF90_ENDDEF( id_set_sp ) 4615 CALL handle_netcdf_error( 'netcdf', 292 )4327 CALL netcdf_handle_error( 'netcdf_define_header', 292 ) 4616 4328 4617 4329 ! … … 4624 4336 nc_stat = NF90_PUT_VAR( id_set_sp, id_var_zu_sp, netcdf_data, & 4625 4337 start = (/ 1 /), count = (/ ns /) ) 4626 CALL handle_netcdf_error( 'netcdf', 293 )4338 CALL netcdf_handle_error( 'netcdf_define_header', 293 ) 4627 4339 4628 4340 ! … … 4631 4343 nc_stat = NF90_PUT_VAR( id_set_sp, id_var_zw_sp, netcdf_data, & 4632 4344 start = (/ 1 /), count = (/ ns /) ) 4633 CALL handle_netcdf_error( 'netcdf', 294 )4345 CALL netcdf_handle_error( 'netcdf_define_header', 294 ) 4634 4346 4635 4347 DEALLOCATE( netcdf_data ) … … 4644 4356 nc_stat = NF90_PUT_VAR( id_set_sp, id_var_x_sp, netcdf_data, & 4645 4357 start = (/ 1 /), count = (/ nx/2 /) ) 4646 CALL handle_netcdf_error( 'netcdf', 295 )4358 CALL netcdf_handle_error( 'netcdf_define_header', 295 ) 4647 4359 4648 4360 DEALLOCATE( netcdf_data ) … … 4655 4367 nc_stat = NF90_PUT_VAR( id_set_sp, id_var_y_sp, netcdf_data, & 4656 4368 start = (/ 1 /), count = (/ ny/2 /) ) 4657 CALL handle_netcdf_error( 'netcdf', 296 )4369 CALL netcdf_handle_error( 'netcdf_define_header', 296 ) 4658 4370 4659 4371 DEALLOCATE( netcdf_data ) … … 4669 4381 nc_stat = NF90_GET_ATT( id_set_sp, NF90_GLOBAL, 'VAR_LIST', & 4670 4382 var_list_old ) 4671 CALL handle_netcdf_error( 'netcdf', 297 )4383 CALL netcdf_handle_error( 'netcdf_define_header', 297 ) 4672 4384 var_list = ';' 4673 4385 i = 1 … … 4711 4423 !-- Get and compare the number of vertical levels 4712 4424 nc_stat = NF90_INQ_VARID( id_set_sp, 'zu_sp', id_var_zu_sp ) 4713 CALL handle_netcdf_error( 'netcdf', 298 )4425 CALL netcdf_handle_error( 'netcdf_define_header', 298 ) 4714 4426 4715 4427 nc_stat = NF90_INQUIRE_VARIABLE( id_set_sp, id_var_zu_sp, & 4716 4428 dimids = id_dim_zu_sp_old ) 4717 CALL handle_netcdf_error( 'netcdf', 299 )4429 CALL netcdf_handle_error( 'netcdf_define_header', 299 ) 4718 4430 id_dim_zu_sp = id_dim_zu_sp_old(1) 4719 4431 4720 4432 nc_stat = NF90_INQUIRE_DIMENSION( id_set_sp, id_dim_zu_sp, & 4721 4433 len = ns_old ) 4722 CALL handle_netcdf_error( 'netcdf', 300 )4434 CALL netcdf_handle_error( 'netcdf_define_header', 300 ) 4723 4435 4724 4436 IF ( ns /= ns_old ) THEN … … 4739 4451 4740 4452 nc_stat = NF90_GET_VAR( id_set_sp, id_var_zu_sp, netcdf_data ) 4741 CALL handle_netcdf_error( 'netcdf', 301 )4453 CALL netcdf_handle_error( 'netcdf_define_header', 301 ) 4742 4454 4743 4455 DO i = 1, ns … … 4763 4475 !-- on the file. 4764 4476 nc_stat = NF90_INQ_VARID( id_set_sp, 'time', id_var_time_sp ) 4765 CALL handle_netcdf_error( 'netcdf', 302 )4477 CALL netcdf_handle_error( 'netcdf_define_header', 302 ) 4766 4478 4767 4479 nc_stat = NF90_INQUIRE_VARIABLE( id_set_sp, id_var_time_sp, & 4768 4480 dimids = id_dim_time_old ) 4769 CALL handle_netcdf_error( 'netcdf', 303 )4481 CALL netcdf_handle_error( 'netcdf_define_header', 303 ) 4770 4482 id_dim_time_sp = id_dim_time_old(1) 4771 4483 4772 4484 nc_stat = NF90_INQUIRE_DIMENSION( id_set_sp, id_dim_time_sp, & 4773 4485 len = dosp_time_count ) 4774 CALL handle_netcdf_error( 'netcdf', 304 )4486 CALL netcdf_handle_error( 'netcdf_define_header', 304 ) 4775 4487 4776 4488 nc_stat = NF90_GET_VAR( id_set_sp, id_var_time_sp, & … … 4778 4490 start = (/ dosp_time_count /), & 4779 4491 count = (/ 1 /) ) 4780 CALL handle_netcdf_error( 'netcdf', 305 )4492 CALL netcdf_handle_error( 'netcdf_define_header', 305 ) 4781 4493 4782 4494 IF ( last_time_coordinate(1) >= simulated_time ) THEN … … 4804 4516 nc_stat = NF90_INQ_VARID( id_set_sp, netcdf_var_name, & 4805 4517 id_var_dospx(i) ) 4806 CALL handle_netcdf_error( 'netcdf', 306 )4518 CALL netcdf_handle_error( 'netcdf_define_header', 306 ) 4807 4519 ENDIF 4808 4520 … … 4811 4523 nc_stat = NF90_INQ_VARID( id_set_sp, netcdf_var_name, & 4812 4524 id_var_dospy(i) ) 4813 CALL handle_netcdf_error( 'netcdf', 307 )4525 CALL netcdf_handle_error( 'netcdf_define_header', 307 ) 4814 4526 ENDIF 4815 4527 … … 4826 4538 !-- to ensure equal attribute size in a job chain. Maybe revise later. 4827 4539 nc_stat = NF90_REDEF( id_set_sp ) 4828 CALL handle_netcdf_error( 'netcdf', 441 )4540 CALL netcdf_handle_error( 'netcdf_define_header', 441 ) 4829 4541 IF ( averaging_interval_sp /= 0.0_wp ) THEN 4830 4542 WRITE (time_average_text,'('', '',F7.1,'' s average'')') & … … 4833 4545 TRIM( run_description_header ) // & 4834 4546 TRIM( time_average_text ) ) 4835 CALL handle_netcdf_error( 'netcdf', 308 )4547 CALL netcdf_handle_error( 'netcdf_define_header', 308 ) 4836 4548 4837 4549 WRITE ( time_average_text,'(F7.1,'' s avg'')' ) averaging_interval_sp … … 4842 4554 TRIM( run_description_header ) ) 4843 4555 ENDIF 4844 CALL handle_netcdf_error( 'netcdf', 309 )4556 CALL netcdf_handle_error( 'netcdf_define_header', 309 ) 4845 4557 nc_stat = NF90_ENDDEF( id_set_sp ) 4846 CALL handle_netcdf_error( 'netcdf', 442 )4558 CALL netcdf_handle_error( 'netcdf_define_header', 442 ) 4847 4559 message_string = 'netCDF file for spectra ' // & 4848 4560 'from previous run found.' // & … … 4857 4569 nc_stat = NF90_PUT_ATT( id_set_prt, NF90_GLOBAL, 'title', & 4858 4570 TRIM( run_description_header ) ) 4859 CALL handle_netcdf_error( 'netcdf', 310 )4571 CALL netcdf_handle_error( 'netcdf_define_header', 310 ) 4860 4572 4861 4573 ! 4862 4574 !-- Define time coordinate for particles (unlimited dimension) 4863 nc_stat = NF90_DEF_DIM( id_set_prt, 'time', NF90_UNLIMITED, & 4864 id_dim_time_prt ) 4865 CALL handle_netcdf_error( 'netcdf', 311 ) 4866 4867 nc_stat = NF90_DEF_VAR( id_set_prt, 'time', NF90_DOUBLE, & 4868 id_dim_time_prt, id_var_time_prt ) 4869 CALL handle_netcdf_error( 'netcdf', 312 ) 4870 4871 nc_stat = NF90_PUT_ATT( id_set_prt, id_var_time_prt, 'units', & 4872 'seconds' ) 4873 CALL handle_netcdf_error( 'netcdf', 313 ) 4874 4575 CALL netcdf_create_dim( id_set_prt, 'time', NF90_UNLIMITED, & 4576 id_dim_time_prt, 311 ) 4577 CALL netcdf_create_var( id_set_prt, (/ id_dim_time_prt /), 'time', & 4578 NF90_DOUBLE, id_var_time_prt, 'seconds', '', & 4579 312, 313, 000 ) 4875 4580 ! 4876 4581 !-- Define particle coordinate (maximum particle number) 4877 4582 IF ( netcdf_data_format < 3 ) THEN 4878 nc_stat = NF90_DEF_DIM( id_set_prt, 'particle_number', & 4879 maximum_number_of_particles, id_dim_prtnum) 4583 CALL netcdf_create_dim( id_set_prt, 'particle_number', & 4584 maximum_number_of_particles, & 4585 id_dim_prtnum, 314 ) 4880 4586 ELSE 4881 4587 ! 4882 4588 !-- netCDF4 allows more than one unlimited dimension 4883 nc_stat = NF90_DEF_DIM( id_set_prt, 'particle_number', & 4884 NF90_UNLIMITED, id_dim_prtnum) 4885 ENDIF 4886 CALL handle_netcdf_error( 'netcdf', 314 ) 4887 4888 nc_stat = NF90_DEF_VAR( id_set_prt, 'particle_number', NF90_DOUBLE, & 4889 id_dim_prtnum, id_var_prtnum ) 4890 CALL handle_netcdf_error( 'netcdf', 315 ) 4891 4892 nc_stat = NF90_PUT_ATT( id_set_prt, id_var_prtnum, 'units', & 4893 'particle number' ) 4894 CALL handle_netcdf_error( 'netcdf', 316 ) 4895 4589 CALL netcdf_create_dim( id_set_prt, 'particle_number', & 4590 NF90_UNLIMITED, id_dim_prtnum, 314 ) 4591 ENDIF 4592 4593 CALL netcdf_create_var( id_set_prt, (/ id_dim_prtnum /), & 4594 'particle_number', NF90_DOUBLE, & 4595 id_var_prtnum, 'particle number', '', 315, & 4596 316, 000 ) 4896 4597 ! 4897 4598 !-- Define variable which contains the real number of particles in use 4898 nc_stat = NF90_DEF_VAR( id_set_prt, 'real_num_of_prt', NF90_INT, & 4899 id_dim_time_prt, id_var_rnop_prt ) 4900 CALL handle_netcdf_error( 'netcdf', 317 ) 4901 4902 nc_stat = NF90_PUT_ATT( id_set_prt, id_var_rnop_prt, 'units', & 4903 'particle number' ) 4904 CALL handle_netcdf_error( 'netcdf', 318 ) 4905 4599 CALL netcdf_create_var( id_set_prt, (/ id_dim_time_prt /), & 4600 'real_num_of_prt', NF90_DOUBLE, & 4601 id_var_rnop_prt, 'particle number', '', 317, & 4602 318, 000 ) 4906 4603 ! 4907 4604 !-- Define the variables 4908 4605 DO i = 1, 17 4909 4606 4910 nc_stat = NF90_DEF_VAR( id_set_prt, prt_var_names(i), & 4911 nc_precision(8), & 4912 (/ id_dim_prtnum, id_dim_time_prt /), & 4913 id_var_prt(i) ) 4914 CALL handle_netcdf_error( 'netcdf', 319 ) 4915 4916 nc_stat = NF90_PUT_ATT( id_set_prt, id_var_prt(i), & 4917 'long_name', TRIM( prt_var_names(i) ) ) 4918 CALL handle_netcdf_error( 'netcdf', 320 ) 4919 4920 nc_stat = NF90_PUT_ATT( id_set_prt, id_var_prt(i), & 4921 'units', TRIM( prt_var_units(i) ) ) 4922 CALL handle_netcdf_error( 'netcdf', 321 ) 4607 CALL netcdf_create_var( id_set_prt, (/ id_dim_prtnum, & 4608 id_dim_time_prt /), prt_var_names(i), & 4609 nc_precision(8), id_var_prt(i), & 4610 TRIM( prt_var_units(i) ), & 4611 TRIM( prt_var_names(i) ), 319, 320, 321 ) 4923 4612 4924 4613 ENDDO … … 4927 4616 !-- Leave netCDF define mode 4928 4617 nc_stat = NF90_ENDDEF( id_set_prt ) 4929 CALL handle_netcdf_error( 'netcdf', 322 )4618 CALL netcdf_handle_error( 'netcdf_define_header', 322 ) 4930 4619 4931 4620 … … 4938 4627 !-- on the file. 4939 4628 nc_stat = NF90_INQ_VARID( id_set_prt, 'time', id_var_time_prt ) 4940 CALL handle_netcdf_error( 'netcdf', 323 )4629 CALL netcdf_handle_error( 'netcdf_define_header', 323 ) 4941 4630 4942 4631 nc_stat = NF90_INQUIRE_VARIABLE( id_set_prt, id_var_time_prt, & 4943 4632 dimids = id_dim_time_old ) 4944 CALL handle_netcdf_error( 'netcdf', 324 )4633 CALL netcdf_handle_error( 'netcdf_define_header', 324 ) 4945 4634 id_dim_time_prt = id_dim_time_old(1) 4946 4635 4947 4636 nc_stat = NF90_INQUIRE_DIMENSION( id_set_prt, id_dim_time_prt, & 4948 4637 len = prt_time_count ) 4949 CALL handle_netcdf_error( 'netcdf', 325 )4638 CALL netcdf_handle_error( 'netcdf_define_header', 325 ) 4950 4639 4951 4640 nc_stat = NF90_GET_VAR( id_set_prt, id_var_time_prt, & … … 4953 4642 start = (/ prt_time_count /), & 4954 4643 count = (/ 1 /) ) 4955 CALL handle_netcdf_error( 'netcdf', 326 )4644 CALL netcdf_handle_error( 'netcdf_define_header', 326 ) 4956 4645 4957 4646 IF ( last_time_coordinate(1) >= simulated_time ) THEN … … 4974 4663 nc_stat = NF90_INQ_VARID( id_set_prt, 'real_num_of_prt', & 4975 4664 id_var_rnop_prt ) 4976 CALL handle_netcdf_error( 'netcdf', 327 )4665 CALL netcdf_handle_error( 'netcdf_define_header', 327 ) 4977 4666 4978 4667 DO i = 1, 17 … … 4980 4669 nc_stat = NF90_INQ_VARID( id_set_prt, prt_var_names(i), & 4981 4670 id_var_prt(i) ) 4982 CALL handle_netcdf_error( 'netcdf', 328 )4671 CALL netcdf_handle_error( 'netcdf_define_header', 328 ) 4983 4672 4984 4673 ENDDO … … 4997 4686 nc_stat = NF90_PUT_ATT( id_set_pts, NF90_GLOBAL, 'title', & 4998 4687 TRIM( run_description_header ) ) 4999 CALL handle_netcdf_error( 'netcdf', 396 )4688 CALL netcdf_handle_error( 'netcdf_define_header', 396 ) 5000 4689 5001 4690 ! 5002 4691 !-- Define time coordinate for particle time series (unlimited dimension) 5003 nc_stat = NF90_DEF_DIM( id_set_pts, 'time', NF90_UNLIMITED, & 5004 id_dim_time_pts ) 5005 CALL handle_netcdf_error( 'netcdf', 397 ) 5006 5007 nc_stat = NF90_DEF_VAR( id_set_pts, 'time', NF90_DOUBLE, & 5008 id_dim_time_pts, id_var_time_pts ) 5009 CALL handle_netcdf_error( 'netcdf', 398 ) 5010 5011 nc_stat = NF90_PUT_ATT( id_set_pts, id_var_time_pts, 'units', & 5012 'seconds') 5013 CALL handle_netcdf_error( 'netcdf', 399 ) 5014 4692 CALL netcdf_create_dim( id_set_pts, 'time', NF90_UNLIMITED, & 4693 id_dim_time_pts, 397 ) 4694 CALL netcdf_create_var( id_set_pts, (/ id_dim_time_pts /), 'time', & 4695 NF90_DOUBLE, id_var_time_pts, 'seconds', '', & 4696 398, 399, 000 ) 5015 4697 ! 5016 4698 !-- Define the variables. If more than one particle group is defined, … … 5027 4709 ENDIF 5028 4710 5029 nc_stat = NF90_DEF_VAR( id_set_pts, &5030 TRIM( dopts_label(i) ) // suffix1, &5031 nc_precision(6), &5032 (/ id_dim_time_pts /), &5033 id_var_dopts(i,j) )5034 CALL handle_netcdf_error( 'netcdf', 400 )5035 5036 4711 IF ( j == 0 ) THEN 5037 nc_stat = NF90_PUT_ATT( id_set_pts, id_var_dopts(i,j), & 5038 'long_name', & 5039 TRIM( dopts_label(i) ) ) 4712 CALL netcdf_create_var( id_set_pts, (/ id_dim_time_pts /), & 4713 TRIM( dopts_label(i) ) // suffix1, & 4714 nc_precision(6), id_var_dopts(i,j), & 4715 TRIM( dopts_unit(i) ), & 4716 TRIM( dopts_label(i) ), 400, 401, & 4717 402 ) 5040 4718 ELSE 5041 nc_stat = NF90_PUT_ATT( id_set_pts, id_var_dopts(i,j), & 5042 'long_name', & 4719 CALL netcdf_create_var( id_set_pts, (/ id_dim_time_pts /), & 4720 TRIM( dopts_label(i) ) // suffix1, & 4721 nc_precision(6), id_var_dopts(i,j), & 4722 TRIM( dopts_unit(i) ), & 5043 4723 TRIM( dopts_label(i) ) // ' PG ' // & 5044 suffix1(2:3) )4724 suffix1(2:3), 400, 401, 402 ) 5045 4725 ENDIF 5046 CALL handle_netcdf_error( 'netcdf', 401 )5047 5048 nc_stat = NF90_PUT_ATT( id_set_pts, id_var_dopts(i,j), &5049 'units', TRIM( dopts_unit(i) ) )5050 CALL handle_netcdf_error( 'netcdf', 402 )5051 4726 5052 4727 var_list = TRIM( var_list ) // TRIM( dopts_label(i) ) // & … … 5064 4739 nc_stat = NF90_PUT_ATT( id_set_pts, NF90_GLOBAL, 'VAR_LIST', & 5065 4740 var_list ) 5066 CALL handle_netcdf_error( 'netcdf', 403 )4741 CALL netcdf_handle_error( 'netcdf_define_header', 403 ) 5067 4742 5068 4743 … … 5070 4745 !-- Leave netCDF define mode 5071 4746 nc_stat = NF90_ENDDEF( id_set_pts ) 5072 CALL handle_netcdf_error( 'netcdf', 404 )4747 CALL netcdf_handle_error( 'netcdf_define_header', 404 ) 5073 4748 5074 4749 … … 5082 4757 nc_stat = NF90_GET_ATT( id_set_pts, NF90_GLOBAL, 'VAR_LIST', & 5083 4758 var_list_old ) 5084 CALL handle_netcdf_error( 'netcdf', 405 )4759 CALL netcdf_handle_error( 'netcdf_define_header', 405 ) 5085 4760 5086 4761 var_list = ';' … … 5122 4797 !-- on the file. 5123 4798 nc_stat = NF90_INQ_VARID( id_set_pts, 'time', id_var_time_pts ) 5124 CALL handle_netcdf_error( 'netcdf', 406 )4799 CALL netcdf_handle_error( 'netcdf_define_header', 406 ) 5125 4800 5126 4801 nc_stat = NF90_INQUIRE_VARIABLE( id_set_pts, id_var_time_pts, & 5127 4802 dimids = id_dim_time_old ) 5128 CALL handle_netcdf_error( 'netcdf', 407 )4803 CALL netcdf_handle_error( 'netcdf_define_header', 407 ) 5129 4804 id_dim_time_pts = id_dim_time_old(1) 5130 4805 5131 4806 nc_stat = NF90_INQUIRE_DIMENSION( id_set_pts, id_dim_time_pts, & 5132 4807 len = dopts_time_count ) 5133 CALL handle_netcdf_error( 'netcdf', 408 )4808 CALL netcdf_handle_error( 'netcdf_define_header', 408 ) 5134 4809 5135 4810 nc_stat = NF90_GET_VAR( id_set_pts, id_var_time_pts, & … … 5137 4812 start = (/ dopts_time_count /), & 5138 4813 count = (/ 1 /) ) 5139 CALL handle_netcdf_error( 'netcdf', 409 )4814 CALL netcdf_handle_error( 'netcdf_define_header', 409 ) 5140 4815 5141 4816 IF ( last_time_coordinate(1) >= simulated_time ) THEN … … 5171 4846 nc_stat = NF90_INQ_VARID( id_set_pts, netcdf_var_name, & 5172 4847 id_var_dopts(i,j) ) 5173 CALL handle_netcdf_error( 'netcdf', 410 )4848 CALL netcdf_handle_error( 'netcdf_define_header', 410 ) 5174 4849 5175 4850 IF ( number_of_particle_groups == 1 ) EXIT … … 5187 4862 !-- to ensure equal attribute size in a job chain. Maybe revise later. 5188 4863 nc_stat = NF90_REDEF( id_set_pts ) 5189 CALL handle_netcdf_error( 'netcdf', 443 )4864 CALL netcdf_handle_error( 'netcdf_define_header', 443 ) 5190 4865 nc_stat = NF90_PUT_ATT( id_set_pts, NF90_GLOBAL, 'title', & 5191 4866 TRIM( run_description_header ) ) 5192 CALL handle_netcdf_error( 'netcdf', 411 )4867 CALL netcdf_handle_error( 'netcdf_define_header', 411 ) 5193 4868 nc_stat = NF90_ENDDEF( id_set_pts ) 5194 CALL handle_netcdf_error( 'netcdf', 444 )4869 CALL netcdf_handle_error( 'netcdf_define_header', 444 ) 5195 4870 message_string = 'netCDF file for particle time series ' // & 5196 4871 'from previous run found.' // & 5197 4872 '&This file will be extended.' 5198 CALL message( ' define_netcdf_header', 'PA0269', 0, 0, 0, 6, 0 )4873 CALL message( 'netcdf_define_header', 'PA0269', 0, 0, 0, 6, 0 ) 5199 4874 5200 4875 … … 5202 4877 5203 4878 message_string = 'mode "' // TRIM( mode) // '" not supported' 5204 CALL message( ' define_netcdf_header', 'PA0270', 0, 0, 0, 6, 0 )4879 CALL message( 'netcdf_define_header', 'PA0270', 0, 0, 0, 6, 0 ) 5205 4880 5206 4881 END SELECT 5207 4882 5208 4883 #endif 5209 END SUBROUTINE define_netcdf_header4884 END SUBROUTINE netcdf_define_header 5210 4885 5211 4886 … … 5217 4892 !------------------------------------------------------------------------------! 5218 4893 5219 SUBROUTINE create_netcdf_file( filename , id, parallel, errno )4894 SUBROUTINE netcdf_create_file( filename , id, parallel, errno ) 5220 4895 #if defined( __netcdf ) 5221 4896 5222 5223 USE control_parameters5224 USE netcdf5225 USE netcdf_control5226 4897 USE pegrid 5227 4898 … … 5284 4955 ENDIF 5285 4956 5286 CALL handle_netcdf_error( 'create_netcdf_file', errno )4957 CALL netcdf_handle_error( 'netcdf_create_file', errno ) 5287 4958 #endif 5288 END SUBROUTINE create_netcdf_file4959 END SUBROUTINE netcdf_create_file 5289 4960 5290 4961 … … 5296 4967 !------------------------------------------------------------------------------! 5297 4968 5298 SUBROUTINE open_write_netcdf_file( filename, id, parallel, errno )4969 SUBROUTINE netcdf_open_write_file( filename, id, parallel, errno ) 5299 4970 #if defined( __netcdf ) 5300 5301 5302 USE control_parameters, &5303 ONLY: netcdf_data_format5304 5305 USE netcdf5306 5307 USE netcdf_control5308 4971 5309 4972 USE pegrid … … 5328 4991 ENDIF 5329 4992 5330 CALL handle_netcdf_error( 'open_write_netcdf_file', errno )4993 CALL netcdf_handle_error( 'netcdf_open_write_file', errno ) 5331 4994 #endif 5332 END SUBROUTINE open_write_netcdf_file4995 END SUBROUTINE netcdf_open_write_file 5333 4996 5334 4997 … … 5339 5002 !------------------------------------------------------------------------------! 5340 5003 5341 SUBROUTINE handle_netcdf_error( routine_name, errno )5004 SUBROUTINE netcdf_handle_error( routine_name, errno ) 5342 5005 #if defined( __netcdf ) 5343 5006 … … 5346 5009 ONLY: message_string 5347 5010 5348 USE netcdf5349 5350 USE netcdf_control5351 5352 USE pegrid5353 5354 5011 IMPLICIT NONE 5355 5012 … … 5369 5026 5370 5027 #endif 5371 END SUBROUTINE handle_netcdf_error 5028 END SUBROUTINE netcdf_handle_error 5029 5030 5031 !------------------------------------------------------------------------------! 5032 ! Description: 5033 ! ------------ 5034 !> Create a dimension in NetCDF file 5035 !------------------------------------------------------------------------------! 5036 5037 SUBROUTINE netcdf_create_dim(ncid, dim_name, ncdim_type, ncdim_id, error_no) 5038 5039 #if defined( __netcdf ) 5040 5041 USE kinds 5042 5043 IMPLICIT NONE 5044 5045 CHARACTER(LEN=*), INTENT(IN) :: dim_name 5046 5047 INTEGER, INTENT(IN) :: error_no 5048 INTEGER, INTENT(IN) :: ncid 5049 INTEGER, INTENT(OUT) :: ncdim_id 5050 INTEGER, INTENT(IN) :: ncdim_type 5051 5052 ! 5053 !-- Define time coordinate for volume data (unlimited dimension) 5054 nc_stat = NF90_DEF_DIM( ncid, dim_name, ncdim_type, ncdim_id ) 5055 CALL netcdf_handle_error( 'netcdf_create_dim', error_no ) 5056 5057 #endif 5058 5059 END SUBROUTINE netcdf_create_dim 5060 5061 5062 !------------------------------------------------------------------------------! 5063 ! Description: 5064 ! ------------ 5065 !> Create a one dimensional variable in specific units in NetCDF file 5066 !------------------------------------------------------------------------------! 5067 5068 SUBROUTINE netcdf_create_var( ncid, dim_id, var_name, var_type, var_id, & 5069 unit_name, long_name, error_no1, error_no2, & 5070 error_no3 ) 5071 5072 #if defined( __netcdf ) 5073 IMPLICIT NONE 5074 5075 CHARACTER(LEN=*), INTENT(IN) :: long_name 5076 CHARACTER(LEN=*), INTENT(IN) :: unit_name 5077 CHARACTER(LEN=*), INTENT(IN) :: var_name 5078 5079 INTEGER, INTENT(IN) :: error_no1 5080 INTEGER, INTENT(IN) :: error_no2 5081 INTEGER, INTENT(IN) :: error_no3 5082 INTEGER, INTENT(IN) :: ncid 5083 INTEGER, INTENT(OUT) :: var_id 5084 INTEGER, INTENT(IN) :: var_type 5085 5086 INTEGER, DIMENSION(:), INTENT(IN) :: dim_id 5087 5088 ! 5089 !-- Define variable 5090 nc_stat = NF90_DEF_VAR( ncid, var_name, var_type, dim_id, var_id ) 5091 CALL netcdf_handle_error( 'netcdf_create_var', error_no1 ) 5092 5093 #if defined( __netcdf4 ) 5094 ! 5095 !-- Check if variable should be deflate (including shuffling) 5096 !-- and if it is possible (only NetCDF4 with HDF5 supports compression) 5097 IF ( netcdf_data_format > 2 .AND. netcdf_deflate > 0 ) THEN 5098 nc_stat = NF90_DEF_VAR_DEFLATE( ncid, var_id, 1, 1, netcdf_deflate ) 5099 CALL netcdf_handle_error( 'netcdf_create_var_deflate', error_no1 ) 5100 ENDIF 5101 #endif 5102 ! 5103 !-- Set unit name if set 5104 IF ( unit_name /= '' ) THEN 5105 nc_stat = NF90_PUT_ATT( ncid, var_id, 'units', unit_name ) 5106 CALL netcdf_handle_error( 'netcdf_create_var', error_no2 ) 5107 ENDIF 5108 5109 ! 5110 !-- Set long name if set 5111 IF ( long_name /= '' ) THEN 5112 nc_stat = NF90_PUT_ATT( ncid, var_id, 'long_name', long_name ) 5113 CALL netcdf_handle_error( 'netcdf_create_var', error_no3 ) 5114 ENDIF 5115 5116 #endif 5117 END SUBROUTINE netcdf_create_var 5118 5119 END MODULE netcdf_interface -
palm/trunk/SOURCE/palm.f90
r1782 r1783 19 19 ! Current revisions: 20 20 ! ----------------- 21 ! 21 ! required user interface version changed 22 22 ! 23 23 ! Former revisions: … … 186 186 187 187 version = 'PALM 4.0' 188 user_interface_required_revision = 'r1 663'188 user_interface_required_revision = 'r1783' 189 189 190 190 #if defined( __parallel ) -
palm/trunk/SOURCE/parin.f90
r1765 r1783 19 19 ! Current revisions: 20 20 ! ----------------- 21 ! 21 ! +netcdf_deflate in d3par, netcdf module and variable names changed 22 22 ! 23 23 ! Former revisions: … … 206 206 207 207 USE pegrid 208 209 USE netcdf_interface, & 210 ONLY: netcdf_data_format, netcdf_deflate, netcdf_precision 208 211 209 212 USE pmc_interface, & … … 297 300 dt_run_control,end_time, force_print_header, mask_scale_x, & 298 301 mask_scale_y, mask_scale_z, mask_x, mask_y, mask_z, mask_x_loop, & 299 mask_y_loop, mask_z_loop, netcdf_data_format, n ormalizing_region,&300 n pex, npey, nz_do3d, precipitation_amount_interval,&301 pr ofile_columns, profile_rows, restart_time, section_xy,&302 section_xz, section_yz, skip_time_data_output,&303 skip_time_data_output _av, skip_time_dopr, skip_time_do2d_xy,&304 skip_time_do2d_x z, skip_time_do2d_yz, skip_time_do3d,&305 skip_time_do mask, synchronous_exchange, termination_time_needed,&306 z_max_do2d302 mask_y_loop, mask_z_loop, netcdf_data_format, netcdf_deflate, & 303 normalizing_region, npex, npey, nz_do3d, & 304 precipitation_amount_interval, profile_columns, profile_rows, & 305 restart_time, section_xy, section_xz, section_yz, & 306 skip_time_data_output, skip_time_data_output_av, skip_time_dopr, & 307 skip_time_do2d_xy, skip_time_do2d_xz, skip_time_do2d_yz, & 308 skip_time_do3d, skip_time_domask, synchronous_exchange, & 309 termination_time_needed, z_max_do2d 307 310 308 311 -
palm/trunk/SOURCE/pmc_client.f90
r1780 r1783 20 20 ! Current revisions: 21 21 ! ------------------ 22 ! 22 ! Bugfix: wrong data-type in MPI_WIN_CREATE replaced 23 23 ! 24 24 ! Former revisions: … … 263 263 264 264 ALLOCATE(myInd(2*WinSize)) 265 WinSize = WinSize*c_sizeof(i)265 WinSize = 1 266 266 267 267 ! local Buffer used in MPI_Get can but must not be inside the MPI Window 268 268 ! Here, we use a dummy for MPI Window because the server PEs do not access the RMA window via MPI_get or MPI_Put 269 269 270 CALL MPI_Win_create (dummy, 1, iwp, MPI_INFO_NULL, me%intra_comm, indWin2, ierr);270 CALL MPI_Win_create (dummy, WinSize, iwp, MPI_INFO_NULL, me%intra_comm, indWin2, ierr); 271 271 272 272 CALL MPI_Win_fence (0, indWin2, ierr) ! MPI_get is Non-blocking -> data in NrEle is not available until MPI_fence CALL -
palm/trunk/SOURCE/pmc_interface.f90
r1782 r1783 20 20 ! Current revisions: 21 21 ! ------------------ 22 ! 22 ! calculation of nest top area simplified, 23 ! interpolation and anterpolation moved to seperate wrapper subroutines 23 24 ! 24 25 ! Former revisions: … … 678 679 INTEGER(iwp), DIMENSION(5) :: val !: 679 680 680 REAL(wp) :: area_t_l !:681 681 REAL(wp), DIMENSION(1) :: fval !: 682 682 REAL(wp) :: xcs !: … … 684 684 REAL(wp) :: ycs !: 685 685 REAL(wp) :: yce !: 686 REAL(wp) :: zct !:687 REAL(wp), DIMENSION(4) :: ztt !:688 686 689 687 … … 830 828 !-- Finally, compute the total area of the top-boundary face of the domain. 831 829 !-- This is needed in the pmc_ensure_nest_mass_conservation 832 area_t_l = ( nxr + 1 - nxl ) * ( nyn + 1 - nys ) * dx * dy 833 IF ( collective_wait ) CALL MPI_BARRIER( comm2d, ierr ) 834 CALL MPI_ALLREDUCE( area_t_l, area_t, 1, MPI_REAL, MPI_SUM, comm2d, ierr ) 835 836 ! 837 !-- TO_DO: Why not just simply? test this! 838 !area_t_l = ( nx + 1 ) * (ny + 1 ) * dx * dy 830 area_t = ( nx + 1 ) * (ny + 1 ) * dx * dy 839 831 840 832 ENDIF … … 1079 1071 1080 1072 REAL(wp), ALLOCATABLE, DIMENSION(:) :: lcr !: 1081 LOGICAL :: more !:1082 1073 1083 1074 ! … … 2399 2390 CALL cpu_log( log_point_s(73), 'PMC Client Recv', 'stop' ) 2400 2391 2401 ! 2402 !-- The interpolation. Add IF-condition here: IF not vertical nesting 2403 IF ( nest_bound_l ) THEN ! Left border pe 2404 CALL pmci_interp_tril_lr( u, uc, icu, jco, kco, r1xu, r2xu, r1yo, r2yo, r1zo, r2zo, & 2405 nzb_u_inner, logc_u_l, logc_ratio_u_l, nzt_topo_nestbc_l, 'l', 'u' ) 2406 CALL pmci_interp_tril_lr( v, vc, ico, jcv, kco, r1xo, r2xo, r1yv, r2yv, r1zo, r2zo, & 2407 nzb_v_inner, logc_v_l, logc_ratio_v_l, nzt_topo_nestbc_l, 'l', 'v' ) 2408 CALL pmci_interp_tril_lr( w, wc, ico, jco, kcw, r1xo, r2xo, r1yo, r2yo, r1zw, r2zw, & 2409 nzb_w_inner, logc_w_l, logc_ratio_w_l, nzt_topo_nestbc_l, 'l', 'w' ) 2410 CALL pmci_interp_tril_lr( e, ec, ico, jco, kco, r1xo, r2xo, r1yo, r2yo, r1zo, r2zo, & 2411 nzb_s_inner, logc_u_l, logc_ratio_u_l, nzt_topo_nestbc_l, 'l', 'e' ) 2412 CALL pmci_interp_tril_lr( pt, ptc, ico, jco, kco, r1xo, r2xo, r1yo, r2yo, r1zo, r2zo, & 2413 nzb_s_inner, logc_u_l, logc_ratio_u_l, nzt_topo_nestbc_l, 'l', 's' ) 2414 IF ( humidity .OR. passive_scalar ) THEN 2415 CALL pmci_interp_tril_lr( q, qc, ico, jco, kco, r1xo, r2xo, r1yo, r2yo, r1zo, r2zo, & 2416 nzb_s_inner, logc_u_l, logc_ratio_u_l, nzt_topo_nestbc_l, 'l', 's' ) 2417 ENDIF 2418 IF ( nesting_mode == 'one-way' ) THEN 2419 CALL pmci_extrap_ifoutflow_lr( u, nzb_u_inner, 'l', 'u' ) 2420 CALL pmci_extrap_ifoutflow_lr( v, nzb_v_inner, 'l', 'v' ) 2421 CALL pmci_extrap_ifoutflow_lr( w, nzb_w_inner, 'l', 'w' ) 2422 CALL pmci_extrap_ifoutflow_lr( e, nzb_s_inner, 'l', 'e' ) 2423 CALL pmci_extrap_ifoutflow_lr( pt,nzb_s_inner, 'l', 's' ) 2424 IF ( humidity .OR. passive_scalar ) THEN 2425 CALL pmci_extrap_ifoutflow_lr( q, nzb_s_inner, 'l', 's' ) 2426 ENDIF 2427 ENDIF 2428 ENDIF 2429 IF ( nest_bound_r ) THEN ! Right border pe 2430 CALL pmci_interp_tril_lr( u, uc, icu, jco, kco, r1xu, r2xu, r1yo, r2yo, r1zo, r2zo, & 2431 nzb_u_inner, logc_u_r, logc_ratio_u_r, nzt_topo_nestbc_r, 'r', 'u' ) 2432 CALL pmci_interp_tril_lr( v, vc, ico, jcv, kco, r1xo, r2xo, r1yv, r2yv, r1zo, r2zo, & 2433 nzb_v_inner, logc_v_r, logc_ratio_v_r, nzt_topo_nestbc_r, 'r', 'v' ) 2434 CALL pmci_interp_tril_lr( w, wc, ico, jco, kcw, r1xo, r2xo, r1yo, r2yo, r1zw, r2zw, & 2435 nzb_w_inner, logc_w_r, logc_ratio_w_r, nzt_topo_nestbc_r, 'r', 'w' ) 2436 CALL pmci_interp_tril_lr( e, ec, ico, jco, kco, r1xo, r2xo, r1yo, r2yo, r1zo, r2zo, & 2437 nzb_s_inner, logc_u_r, logc_ratio_u_r, nzt_topo_nestbc_r, 'r', 'e' ) 2438 CALL pmci_interp_tril_lr( pt, ptc, ico, jco, kco, r1xo, r2xo, r1yo, r2yo, r1zo, r2zo, & 2439 nzb_s_inner, logc_u_r, logc_ratio_u_r, nzt_topo_nestbc_r, 'r', 's' ) 2440 IF ( humidity .OR. passive_scalar ) THEN 2441 CALL pmci_interp_tril_lr( q, qc, ico, jco, kco, r1xo, r2xo, r1yo, r2yo, r1zo, r2zo, & 2442 nzb_s_inner, logc_u_r, logc_ratio_u_r, nzt_topo_nestbc_r, 'r', 's' ) 2443 ENDIF 2444 IF ( nesting_mode == 'one-way' ) THEN 2445 CALL pmci_extrap_ifoutflow_lr( u, nzb_u_inner, 'r', 'u' ) 2446 CALL pmci_extrap_ifoutflow_lr( v, nzb_v_inner, 'r', 'v' ) 2447 CALL pmci_extrap_ifoutflow_lr( w, nzb_w_inner, 'r', 'w' ) 2448 CALL pmci_extrap_ifoutflow_lr( e, nzb_s_inner, 'r', 'e' ) 2449 CALL pmci_extrap_ifoutflow_lr( pt,nzb_s_inner, 'r', 's' ) 2450 IF ( humidity .OR. passive_scalar ) THEN 2451 CALL pmci_extrap_ifoutflow_lr( q, nzb_s_inner, 'r', 's' ) 2452 ENDIF 2453 ENDIF 2454 ENDIF 2455 IF ( nest_bound_s ) THEN ! South border pe 2456 CALL pmci_interp_tril_sn( u, uc, icu, jco, kco, r1xu, r2xu, r1yo, r2yo, r1zo, r2zo, & 2457 nzb_u_inner, logc_u_s, logc_ratio_u_s, nzt_topo_nestbc_s, 's', 'u' ) 2458 CALL pmci_interp_tril_sn( v, vc, ico, jcv, kco, r1xo, r2xo, r1yv, r2yv, r1zo, r2zo, & 2459 nzb_v_inner, logc_v_s, logc_ratio_v_s, nzt_topo_nestbc_s, 's', 'v' ) 2460 CALL pmci_interp_tril_sn( w, wc, ico, jco, kcw, r1xo, r2xo, r1yo, r2yo, r1zw, r2zw, & 2461 nzb_w_inner, logc_w_s, logc_ratio_w_s, nzt_topo_nestbc_s, 's', 'w' ) 2462 CALL pmci_interp_tril_sn( e, ec, ico, jco, kco, r1xo, r2xo, r1yo, r2yo, r1zo, r2zo, & 2463 nzb_s_inner, logc_u_s, logc_ratio_u_s, nzt_topo_nestbc_s, 's', 'e' ) 2464 CALL pmci_interp_tril_sn( pt, ptc, ico, jco, kco, r1xo, r2xo, r1yo, r2yo, r1zo, r2zo, & 2465 nzb_s_inner, logc_u_s, logc_ratio_u_s, nzt_topo_nestbc_s, 's', 's' ) 2466 IF ( humidity .OR. passive_scalar ) THEN 2467 CALL pmci_interp_tril_sn( q, qc, ico, jco, kco, r1xo, r2xo, r1yo, r2yo, r1zo, r2zo, & 2468 nzb_s_inner, logc_u_s, logc_ratio_u_s, nzt_topo_nestbc_s, 's', 's' ) 2469 ENDIF 2470 IF ( nesting_mode == 'one-way' ) THEN 2471 CALL pmci_extrap_ifoutflow_sn( u, nzb_u_inner, 's', 'u' ) 2472 CALL pmci_extrap_ifoutflow_sn( v, nzb_v_inner, 's', 'v' ) 2473 CALL pmci_extrap_ifoutflow_sn( w, nzb_w_inner, 's', 'w' ) 2474 CALL pmci_extrap_ifoutflow_sn( e, nzb_s_inner, 's', 'e' ) 2475 CALL pmci_extrap_ifoutflow_sn( pt,nzb_s_inner, 's', 's' ) 2476 IF ( humidity .OR. passive_scalar ) THEN 2477 CALL pmci_extrap_ifoutflow_sn( q, nzb_s_inner, 's', 's' ) 2478 ENDIF 2479 ENDIF 2480 ENDIF 2481 IF ( nest_bound_n ) THEN ! North border pe 2482 CALL pmci_interp_tril_sn( u, uc, icu, jco, kco, r1xu, r2xu, r1yo, r2yo, r1zo, r2zo, & 2483 nzb_u_inner, logc_u_n, logc_ratio_u_n, nzt_topo_nestbc_n, 'n', 'u' ) 2484 CALL pmci_interp_tril_sn( v, vc, ico, jcv, kco, r1xo, r2xo, r1yv, r2yv, r1zo, r2zo, & 2485 nzb_v_inner, logc_v_n, logc_ratio_v_n, nzt_topo_nestbc_n, 'n', 'v' ) 2486 CALL pmci_interp_tril_sn( w, wc, ico, jco, kcw, r1xo, r2xo, r1yo, r2yo, r1zw, r2zw, & 2487 nzb_w_inner, logc_w_n, logc_ratio_w_n, nzt_topo_nestbc_n, 'n', 'w' ) 2488 CALL pmci_interp_tril_sn( e, ec, ico,jco,kco,r1xo,r2xo,r1yo,r2yo,r1zo,r2zo, & 2489 nzb_s_inner, logc_u_n, logc_ratio_u_n, nzt_topo_nestbc_n, 'n', 'e' ) 2490 CALL pmci_interp_tril_sn( pt, ptc, ico, jco, kco, r1xo, r2xo, r1yo, r2yo, r1zo, r2zo, & 2491 nzb_s_inner, logc_u_n, logc_ratio_u_n, nzt_topo_nestbc_n, 'n', 's' ) 2492 IF ( humidity .OR. passive_scalar ) THEN 2493 CALL pmci_interp_tril_sn( q, qc, ico,jco,kco,r1xo,r2xo,r1yo,r2yo,r1zo,r2zo, & 2494 nzb_s_inner, logc_u_n, logc_ratio_u_n, nzt_topo_nestbc_n, 'n', 's' ) 2495 ENDIF 2496 IF ( nesting_mode == 'one-way' ) THEN 2497 CALL pmci_extrap_ifoutflow_sn( u, nzb_u_inner, 'n', 'u' ) 2498 CALL pmci_extrap_ifoutflow_sn( v, nzb_v_inner, 'n', 'v' ) 2499 CALL pmci_extrap_ifoutflow_sn( w, nzb_w_inner, 'n', 'w' ) 2500 CALL pmci_extrap_ifoutflow_sn( e, nzb_s_inner, 'n', 'e' ) 2501 CALL pmci_extrap_ifoutflow_sn( pt,nzb_s_inner, 'n', 's' ) 2502 IF ( humidity .OR. passive_scalar ) THEN 2503 CALL pmci_extrap_ifoutflow_sn( q, nzb_s_inner, 'n', 's' ) 2504 ENDIF 2505 ENDIF 2506 ENDIF 2507 2508 ! 2509 !-- All PEs are top-border PEs 2510 CALL pmci_interp_tril_t( u, uc, icu, jco, kco, r1xu, r2xu, r1yo, r2yo, r1zo, r2zo, 'u' ) 2511 CALL pmci_interp_tril_t( v, vc, ico, jcv, kco, r1xo, r2xo, r1yv, r2yv, r1zo, r2zo, 'v' ) 2512 CALL pmci_interp_tril_t( w, wc, ico, jco, kcw, r1xo, r2xo, r1yo, r2yo, r1zw, r2zw, 'w' ) 2513 CALL pmci_interp_tril_t( e, ec, ico, jco, kco, r1xo, r2xo, r1yo, r2yo, r1zo, r2zo, 'e' ) 2514 CALL pmci_interp_tril_t( pt, ptc, ico, jco, kco, r1xo, r2xo, r1yo, r2yo, r1zo, r2zo, 's' ) 2515 IF ( humidity .OR. passive_scalar ) THEN 2516 CALL pmci_interp_tril_t( q, qc, ico, jco, kco, r1xo, r2xo, r1yo, r2yo, r1zo, r2zo, 's' ) 2517 ENDIF 2518 IF ( nesting_mode == 'one-way' ) THEN 2519 CALL pmci_extrap_ifoutflow_t( u, 'u' ) 2520 CALL pmci_extrap_ifoutflow_t( v, 'v' ) 2521 CALL pmci_extrap_ifoutflow_t( w, 'w' ) 2522 CALL pmci_extrap_ifoutflow_t( e, 'e' ) 2523 CALL pmci_extrap_ifoutflow_t( pt, 's' ) 2524 IF ( humidity .OR. passive_scalar ) THEN 2525 CALL pmci_extrap_ifoutflow_t( q, 's' ) 2526 ENDIF 2527 ENDIF 2528 ELSE ! IF ( direction == server_to_client ) 2529 CALL pmci_anterp_tophat( u, uc, kceu, iflu, ifuu, jflo, jfuo, kflo, kfuo, nzb_u_inner, 'u' ) 2530 CALL pmci_anterp_tophat( v, vc, kceu, iflo, ifuo, jflv, jfuv, kflo, kfuo, nzb_v_inner, 'v' ) 2531 CALL pmci_anterp_tophat( w, wc, kcew, iflo, ifuo, jflo, jfuo, kflw, kfuw, nzb_w_inner, 'w' ) 2532 CALL pmci_anterp_tophat( pt, ptc, kceu, iflo, ifuo, jflo, jfuo, kflo, kfuo, nzb_s_inner, 's' ) 2533 IF ( humidity .OR. passive_scalar ) THEN 2534 CALL pmci_anterp_tophat( q, qc, kceu, iflo, ifuo, jflo, jfuo, kflo, kfuo, nzb_s_inner, 's' ) 2535 ENDIF 2392 CALL pmci_interpolation 2393 2394 ELSE ! IF ( direction == server_to_client ) 2395 2396 CALL pmci_anterpolation 2397 2536 2398 CALL cpu_log( log_point_s(74), 'PMC Client Send', 'start' ) 2537 2399 CALL pmc_c_putbuffer( WaitTime = WaitTime ) … … 2539 2401 ENDIF 2540 2402 ENDIF 2541 2403 2542 2404 CONTAINS 2405 2406 2407 SUBROUTINE pmci_interpolation 2408 2409 ! 2410 !-- A wrapper routine for all interpolation and extrapolation actions. 2411 IMPLICIT NONE 2412 2413 ! 2414 !-- Add IF-condition here: IF not vertical nesting 2415 IF ( nest_bound_l ) THEN ! Left border pe 2416 CALL pmci_interp_tril_lr( u, uc, icu, jco, kco, r1xu, r2xu, r1yo, r2yo, r1zo, r2zo, & 2417 nzb_u_inner, logc_u_l, logc_ratio_u_l, nzt_topo_nestbc_l, 'l', 'u' ) 2418 CALL pmci_interp_tril_lr( v, vc, ico, jcv, kco, r1xo, r2xo, r1yv, r2yv, r1zo, r2zo, & 2419 nzb_v_inner, logc_v_l, logc_ratio_v_l, nzt_topo_nestbc_l, 'l', 'v' ) 2420 CALL pmci_interp_tril_lr( w, wc, ico, jco, kcw, r1xo, r2xo, r1yo, r2yo, r1zw, r2zw, & 2421 nzb_w_inner, logc_w_l, logc_ratio_w_l, nzt_topo_nestbc_l, 'l', 'w' ) 2422 CALL pmci_interp_tril_lr( e, ec, ico, jco, kco, r1xo, r2xo, r1yo, r2yo, r1zo, r2zo, & 2423 nzb_s_inner, logc_u_l, logc_ratio_u_l, nzt_topo_nestbc_l, 'l', 'e' ) 2424 CALL pmci_interp_tril_lr( pt, ptc, ico, jco, kco, r1xo, r2xo, r1yo, r2yo, r1zo, r2zo, & 2425 nzb_s_inner, logc_u_l, logc_ratio_u_l, nzt_topo_nestbc_l, 'l', 's' ) 2426 IF ( humidity .OR. passive_scalar ) THEN 2427 CALL pmci_interp_tril_lr( q, qc, ico, jco, kco, r1xo, r2xo, r1yo, r2yo, r1zo, r2zo, & 2428 nzb_s_inner, logc_u_l, logc_ratio_u_l, nzt_topo_nestbc_l, 'l', 's' ) 2429 ENDIF 2430 IF ( nesting_mode == 'one-way' ) THEN 2431 CALL pmci_extrap_ifoutflow_lr( u, nzb_u_inner, 'l', 'u' ) 2432 CALL pmci_extrap_ifoutflow_lr( v, nzb_v_inner, 'l', 'v' ) 2433 CALL pmci_extrap_ifoutflow_lr( w, nzb_w_inner, 'l', 'w' ) 2434 CALL pmci_extrap_ifoutflow_lr( e, nzb_s_inner, 'l', 'e' ) 2435 CALL pmci_extrap_ifoutflow_lr( pt,nzb_s_inner, 'l', 's' ) 2436 IF ( humidity .OR. passive_scalar ) THEN 2437 CALL pmci_extrap_ifoutflow_lr( q, nzb_s_inner, 'l', 's' ) 2438 ENDIF 2439 ENDIF 2440 ENDIF 2441 IF ( nest_bound_r ) THEN ! Right border pe 2442 CALL pmci_interp_tril_lr( u, uc, icu, jco, kco, r1xu, r2xu, r1yo, r2yo, r1zo, r2zo, & 2443 nzb_u_inner, logc_u_r, logc_ratio_u_r, nzt_topo_nestbc_r, 'r', 'u' ) 2444 CALL pmci_interp_tril_lr( v, vc, ico, jcv, kco, r1xo, r2xo, r1yv, r2yv, r1zo, r2zo, & 2445 nzb_v_inner, logc_v_r, logc_ratio_v_r, nzt_topo_nestbc_r, 'r', 'v' ) 2446 CALL pmci_interp_tril_lr( w, wc, ico, jco, kcw, r1xo, r2xo, r1yo, r2yo, r1zw, r2zw, & 2447 nzb_w_inner, logc_w_r, logc_ratio_w_r, nzt_topo_nestbc_r, 'r', 'w' ) 2448 CALL pmci_interp_tril_lr( e, ec, ico, jco, kco, r1xo, r2xo, r1yo, r2yo, r1zo, r2zo, & 2449 nzb_s_inner, logc_u_r, logc_ratio_u_r, nzt_topo_nestbc_r, 'r', 'e' ) 2450 CALL pmci_interp_tril_lr( pt, ptc, ico, jco, kco, r1xo, r2xo, r1yo, r2yo, r1zo, r2zo, & 2451 nzb_s_inner, logc_u_r, logc_ratio_u_r, nzt_topo_nestbc_r, 'r', 's' ) 2452 IF ( humidity .OR. passive_scalar ) THEN 2453 CALL pmci_interp_tril_lr( q, qc, ico, jco, kco, r1xo, r2xo, r1yo, r2yo, r1zo, r2zo, & 2454 nzb_s_inner, logc_u_r, logc_ratio_u_r, nzt_topo_nestbc_r, 'r', 's' ) 2455 ENDIF 2456 IF ( nesting_mode == 'one-way' ) THEN 2457 CALL pmci_extrap_ifoutflow_lr( u, nzb_u_inner, 'r', 'u' ) 2458 CALL pmci_extrap_ifoutflow_lr( v, nzb_v_inner, 'r', 'v' ) 2459 CALL pmci_extrap_ifoutflow_lr( w, nzb_w_inner, 'r', 'w' ) 2460 CALL pmci_extrap_ifoutflow_lr( e, nzb_s_inner, 'r', 'e' ) 2461 CALL pmci_extrap_ifoutflow_lr( pt,nzb_s_inner, 'r', 's' ) 2462 IF ( humidity .OR. passive_scalar ) THEN 2463 CALL pmci_extrap_ifoutflow_lr( q, nzb_s_inner, 'r', 's' ) 2464 ENDIF 2465 ENDIF 2466 ENDIF 2467 IF ( nest_bound_s ) THEN ! South border pe 2468 CALL pmci_interp_tril_sn( u, uc, icu, jco, kco, r1xu, r2xu, r1yo, r2yo, r1zo, r2zo, & 2469 nzb_u_inner, logc_u_s, logc_ratio_u_s, nzt_topo_nestbc_s, 's', 'u' ) 2470 CALL pmci_interp_tril_sn( v, vc, ico, jcv, kco, r1xo, r2xo, r1yv, r2yv, r1zo, r2zo, & 2471 nzb_v_inner, logc_v_s, logc_ratio_v_s, nzt_topo_nestbc_s, 's', 'v' ) 2472 CALL pmci_interp_tril_sn( w, wc, ico, jco, kcw, r1xo, r2xo, r1yo, r2yo, r1zw, r2zw, & 2473 nzb_w_inner, logc_w_s, logc_ratio_w_s, nzt_topo_nestbc_s, 's', 'w' ) 2474 CALL pmci_interp_tril_sn( e, ec, ico, jco, kco, r1xo, r2xo, r1yo, r2yo, r1zo, r2zo, & 2475 nzb_s_inner, logc_u_s, logc_ratio_u_s, nzt_topo_nestbc_s, 's', 'e' ) 2476 CALL pmci_interp_tril_sn( pt, ptc, ico, jco, kco, r1xo, r2xo, r1yo, r2yo, r1zo, r2zo, & 2477 nzb_s_inner, logc_u_s, logc_ratio_u_s, nzt_topo_nestbc_s, 's', 's' ) 2478 IF ( humidity .OR. passive_scalar ) THEN 2479 CALL pmci_interp_tril_sn( q, qc, ico, jco, kco, r1xo, r2xo, r1yo, r2yo, r1zo, r2zo, & 2480 nzb_s_inner, logc_u_s, logc_ratio_u_s, nzt_topo_nestbc_s, 's', 's' ) 2481 ENDIF 2482 IF ( nesting_mode == 'one-way' ) THEN 2483 CALL pmci_extrap_ifoutflow_sn( u, nzb_u_inner, 's', 'u' ) 2484 CALL pmci_extrap_ifoutflow_sn( v, nzb_v_inner, 's', 'v' ) 2485 CALL pmci_extrap_ifoutflow_sn( w, nzb_w_inner, 's', 'w' ) 2486 CALL pmci_extrap_ifoutflow_sn( e, nzb_s_inner, 's', 'e' ) 2487 CALL pmci_extrap_ifoutflow_sn( pt,nzb_s_inner, 's', 's' ) 2488 IF ( humidity .OR. passive_scalar ) THEN 2489 CALL pmci_extrap_ifoutflow_sn( q, nzb_s_inner, 's', 's' ) 2490 ENDIF 2491 ENDIF 2492 ENDIF 2493 IF ( nest_bound_n ) THEN ! North border pe 2494 CALL pmci_interp_tril_sn( u, uc, icu, jco, kco, r1xu, r2xu, r1yo, r2yo, r1zo, r2zo, & 2495 nzb_u_inner, logc_u_n, logc_ratio_u_n, nzt_topo_nestbc_n, 'n', 'u' ) 2496 CALL pmci_interp_tril_sn( v, vc, ico, jcv, kco, r1xo, r2xo, r1yv, r2yv, r1zo, r2zo, & 2497 nzb_v_inner, logc_v_n, logc_ratio_v_n, nzt_topo_nestbc_n, 'n', 'v' ) 2498 CALL pmci_interp_tril_sn( w, wc, ico, jco, kcw, r1xo, r2xo, r1yo, r2yo, r1zw, r2zw, & 2499 nzb_w_inner, logc_w_n, logc_ratio_w_n, nzt_topo_nestbc_n, 'n', 'w' ) 2500 CALL pmci_interp_tril_sn( e, ec, ico,jco,kco,r1xo,r2xo,r1yo,r2yo,r1zo,r2zo, & 2501 nzb_s_inner, logc_u_n, logc_ratio_u_n, nzt_topo_nestbc_n, 'n', 'e' ) 2502 CALL pmci_interp_tril_sn( pt, ptc, ico, jco, kco, r1xo, r2xo, r1yo, r2yo, r1zo, r2zo, & 2503 nzb_s_inner, logc_u_n, logc_ratio_u_n, nzt_topo_nestbc_n, 'n', 's' ) 2504 IF ( humidity .OR. passive_scalar ) THEN 2505 CALL pmci_interp_tril_sn( q, qc, ico,jco,kco,r1xo,r2xo,r1yo,r2yo,r1zo,r2zo, & 2506 nzb_s_inner, logc_u_n, logc_ratio_u_n, nzt_topo_nestbc_n, 'n', 's' ) 2507 ENDIF 2508 IF ( nesting_mode == 'one-way' ) THEN 2509 CALL pmci_extrap_ifoutflow_sn( u, nzb_u_inner, 'n', 'u' ) 2510 CALL pmci_extrap_ifoutflow_sn( v, nzb_v_inner, 'n', 'v' ) 2511 CALL pmci_extrap_ifoutflow_sn( w, nzb_w_inner, 'n', 'w' ) 2512 CALL pmci_extrap_ifoutflow_sn( e, nzb_s_inner, 'n', 'e' ) 2513 CALL pmci_extrap_ifoutflow_sn( pt,nzb_s_inner, 'n', 's' ) 2514 IF ( humidity .OR. passive_scalar ) THEN 2515 CALL pmci_extrap_ifoutflow_sn( q, nzb_s_inner, 'n', 's' ) 2516 ENDIF 2517 ENDIF 2518 ENDIF 2519 2520 ! 2521 !-- All PEs are top-border PEs 2522 CALL pmci_interp_tril_t( u, uc, icu, jco, kco, r1xu, r2xu, r1yo, r2yo, r1zo, r2zo, 'u' ) 2523 CALL pmci_interp_tril_t( v, vc, ico, jcv, kco, r1xo, r2xo, r1yv, r2yv, r1zo, r2zo, 'v' ) 2524 CALL pmci_interp_tril_t( w, wc, ico, jco, kcw, r1xo, r2xo, r1yo, r2yo, r1zw, r2zw, 'w' ) 2525 CALL pmci_interp_tril_t( e, ec, ico, jco, kco, r1xo, r2xo, r1yo, r2yo, r1zo, r2zo, 'e' ) 2526 CALL pmci_interp_tril_t( pt, ptc, ico, jco, kco, r1xo, r2xo, r1yo, r2yo, r1zo, r2zo, 's' ) 2527 IF ( humidity .OR. passive_scalar ) THEN 2528 CALL pmci_interp_tril_t( q, qc, ico, jco, kco, r1xo, r2xo, r1yo, r2yo, r1zo, r2zo, 's' ) 2529 ENDIF 2530 IF ( nesting_mode == 'one-way' ) THEN 2531 CALL pmci_extrap_ifoutflow_t( u, 'u' ) 2532 CALL pmci_extrap_ifoutflow_t( v, 'v' ) 2533 CALL pmci_extrap_ifoutflow_t( w, 'w' ) 2534 CALL pmci_extrap_ifoutflow_t( e, 'e' ) 2535 CALL pmci_extrap_ifoutflow_t( pt, 's' ) 2536 IF ( humidity .OR. passive_scalar ) THEN 2537 CALL pmci_extrap_ifoutflow_t( q, 's' ) 2538 ENDIF 2539 ENDIF 2540 END SUBROUTINE pmci_interpolation 2541 2542 2543 2544 SUBROUTINE pmci_anterpolation 2545 2546 ! 2547 !-- A wrapper routine for all anterpolation actions. 2548 IMPLICIT NONE 2549 2550 CALL pmci_anterp_tophat( u, uc, kceu, iflu, ifuu, jflo, jfuo, kflo, kfuo, nzb_u_inner, 'u' ) 2551 CALL pmci_anterp_tophat( v, vc, kceu, iflo, ifuo, jflv, jfuv, kflo, kfuo, nzb_v_inner, 'v' ) 2552 CALL pmci_anterp_tophat( w, wc, kcew, iflo, ifuo, jflo, jfuo, kflw, kfuw, nzb_w_inner, 'w' ) 2553 CALL pmci_anterp_tophat( pt, ptc, kceu, iflo, ifuo, jflo, jfuo, kflo, kfuo, nzb_s_inner, 's' ) 2554 IF ( humidity .OR. passive_scalar ) THEN 2555 CALL pmci_anterp_tophat( q, qc, kceu, iflo, ifuo, jflo, jfuo, kflo, kfuo, nzb_s_inner, 's' ) 2556 ENDIF 2557 2558 END SUBROUTINE pmci_anterpolation 2543 2559 2544 2560 -
palm/trunk/SOURCE/radiation_model.f90
r1758 r1783 19 19 ! Current revisions: 20 20 ! ----------------- 21 ! 21 ! palm-netcdf-module removed in order to avoid a circular module dependency, 22 ! netcdf-variables moved to netcdf-module, new routine netcdf_handle_error_mod 23 ! added 22 24 ! 23 25 ! Former revisions: … … 83 85 MODULE radiation_model_mod 84 86 85 86 87 USE arrays_3d, & 87 88 ONLY: dzw, hyp, pt, q, ql, zw … … 104 105 105 106 #if defined ( __netcdf ) 106 USE netcdf107 USE NETCDF 107 108 #endif 108 109 USE netcdf_control, &110 ONLY: dots_label, dots_num, dots_unit111 109 112 110 #if defined ( __rrtmg ) … … 642 640 CALL user_init_radiation 643 641 644 645 !646 !-- Add timeseries for radiation model647 dots_rad = dots_num + 1648 dots_num = dots_num + 5649 650 dots_label(dots_rad) = "rad_net"651 dots_label(dots_rad+1) = "rad_lw_in"652 dots_label(dots_rad+2) = "rad_lw_out"653 dots_label(dots_rad+3) = "rad_sw_in"654 dots_label(dots_rad+4) = "rad_sw_out"655 dots_unit(dots_rad:dots_rad+4) = "W/m2"656 657 !658 !-- Output of albedos is only required for RRTMG659 IF ( radiation_scheme == 'rrtmg' ) THEN660 dots_num = dots_num + 4661 dots_label(dots_rad+5) = "rrtm_aldif"662 dots_label(dots_rad+6) = "rrtm_aldir"663 dots_label(dots_rad+7) = "rrtm_asdif"664 dots_label(dots_rad+8) = "rrtm_asdir"665 dots_unit(dots_num+5:dots_num+8) = ""666 667 ENDIF668 669 642 ! 670 643 !-- Calculate radiative fluxes at model start … … 1098 1071 !------------------------------------------------------------------------------! 1099 1072 SUBROUTINE read_sounding_data 1100 1101 USE netcdf_control1102 1073 1103 1074 IMPLICIT NONE … … 1168 1139 !-- Open file for reading 1169 1140 nc_stat = NF90_OPEN( rrtm_input_file, NF90_NOWRITE, id ) 1170 CALL handle_netcdf_error( 'netcdf', 549 )1141 CALL netcdf_handle_error_rad( 'read_sounding_data', 549 ) 1171 1142 1172 1143 ! … … 1174 1145 nc_stat = NF90_INQ_DIMID( id, "Pressure", id_dim_zrad ) 1175 1146 nc_stat = NF90_INQUIRE_DIMENSION( id, id_dim_zrad, len = nz_snd ) 1176 CALL handle_netcdf_error( 'netcdf', 551 )1147 CALL netcdf_handle_error_rad( 'read_sounding_data', 551 ) 1177 1148 1178 1149 ! … … 1186 1157 nc_stat = NF90_GET_VAR( id, id_var, hyp_snd_tmp(:), start = (/1/), & 1187 1158 count = (/nz_snd/) ) 1188 CALL handle_netcdf_error( 'netcdf', 552 )1159 CALL netcdf_handle_error_rad( 'read_sounding_data', 552 ) 1189 1160 1190 1161 ! … … 1198 1169 nc_stat = NF90_GET_VAR( id, id_var, t_snd_tmp(:), start = (/1/), & 1199 1170 count = (/nz_snd/) ) 1200 CALL handle_netcdf_error( 'netcdf', 553 )1171 CALL netcdf_handle_error_rad( 'read_sounding_data', 553 ) 1201 1172 1202 1173 ! … … 1371 1342 SUBROUTINE read_trace_gas_data 1372 1343 1373 USE netcdf_control1374 1344 USE rrsw_ncpar 1375 1345 … … 1435 1405 !-- Open file for reading 1436 1406 nc_stat = NF90_OPEN( rrtm_input_file, NF90_NOWRITE, id ) 1437 CALL handle_netcdf_error( 'netcdf', 549 )1407 CALL netcdf_handle_error_rad( 'read_trace_gas_data', 549 ) 1438 1408 ! 1439 1409 !-- Inquire dimension ids and dimensions 1440 1410 nc_stat = NF90_INQ_DIMID( id, "Pressure", id_dim ) 1441 CALL handle_netcdf_error( 'netcdf', 550 )1411 CALL netcdf_handle_error_rad( 'read_trace_gas_data', 550 ) 1442 1412 nc_stat = NF90_INQUIRE_DIMENSION( id, id_dim, len = np) 1443 CALL handle_netcdf_error( 'netcdf', 550 )1413 CALL netcdf_handle_error_rad( 'read_trace_gas_data', 550 ) 1444 1414 1445 1415 nc_stat = NF90_INQ_DIMID( id, "Absorber", id_dim ) 1446 CALL handle_netcdf_error( 'netcdf', 550 )1416 CALL netcdf_handle_error_rad( 'read_trace_gas_data', 550 ) 1447 1417 nc_stat = NF90_INQUIRE_DIMENSION( id, id_dim, len = nabs ) 1448 CALL handle_netcdf_error( 'netcdf', 550 )1418 CALL netcdf_handle_error_rad( 'read_trace_gas_data', 550 ) 1449 1419 1450 1420 … … 1457 1427 1458 1428 nc_stat = NF90_INQ_VARID( id, "Pressure", id_var ) 1459 CALL handle_netcdf_error( 'netcdf', 550 )1429 CALL netcdf_handle_error_rad( 'read_trace_gas_data', 550 ) 1460 1430 nc_stat = NF90_GET_VAR( id, id_var, p_mls ) 1461 CALL handle_netcdf_error( 'netcdf', 550 )1431 CALL netcdf_handle_error_rad( 'read_trace_gas_data', 550 ) 1462 1432 1463 1433 nc_stat = NF90_INQ_VARID( id, "AbsorberAmountMLS", id_var ) 1464 CALL handle_netcdf_error( 'netcdf', 550 )1434 CALL netcdf_handle_error_rad( 'read_trace_gas_data', 550 ) 1465 1435 nc_stat = NF90_GET_VAR( id, id_var, trace_mls_tmp ) 1466 CALL handle_netcdf_error( 'netcdf', 550 )1436 CALL netcdf_handle_error_rad( 'read_trace_gas_data', 550 ) 1467 1437 1468 1438 … … 1484 1454 1485 1455 nc_stat = NF90_CLOSE( id ) 1486 CALL handle_netcdf_error( 'netcdf', 551 )1456 CALL netcdf_handle_error_rad( 'read_trace_gas_data', 551 ) 1487 1457 1488 1458 ! … … 1623 1593 END SUBROUTINE read_trace_gas_data 1624 1594 1595 SUBROUTINE netcdf_handle_error_rad( routine_name, errno ) 1596 1597 USE control_parameters, & 1598 ONLY: message_string 1599 1600 USE NETCDF 1601 1602 USE pegrid 1603 1604 IMPLICIT NONE 1605 1606 CHARACTER(LEN=6) :: message_identifier 1607 CHARACTER(LEN=*) :: routine_name 1608 1609 INTEGER(iwp) :: errno 1610 1611 IF ( nc_stat /= NF90_NOERR ) THEN 1612 1613 WRITE( message_identifier, '(''NC'',I4.4)' ) errno 1614 message_string = TRIM( NF90_STRERROR( nc_stat ) ) 1615 1616 CALL message( routine_name, message_identifier, 2, 2, 0, 6, 1 ) 1617 1618 ENDIF 1619 1620 END SUBROUTINE netcdf_handle_error_rad 1625 1621 #endif 1626 1622 -
palm/trunk/SOURCE/read_var_list.f90
r1700 r1783 19 19 ! Current revisions: 20 20 ! ------------------ 21 ! 21 ! netcdf module name changed + related changes 22 22 ! 23 23 ! Former revisions: … … 173 173 ONLY: damp_level_1d, dt_pr_1d, dt_run_control_1d, end_time_1d 174 174 175 USE netcdf_control 175 USE netcdf_interface, & 176 ONLY: netcdf_precision, output_for_t0 176 177 177 178 USE particle_attributes, & -
palm/trunk/SOURCE/time_integration.f90
r1782 r1783 19 19 ! Current revisions: 20 20 ! ------------------ 21 ! 21 ! switch back of netcdf data format for mask output moved to the mask output 22 ! routine 22 23 ! 23 24 ! Former revisions: … … 200 201 intermediate_timestep_count_max, large_scale_forcing, & 201 202 loop_optimization, lsf_surf, lsf_vert, masks, mid, nest_domain, & 202 ne tcdf_data_format, neutral, nr_timesteps_this_run, nudging,&203 neutral, nr_timesteps_this_run, nudging, & 203 204 ocean, on_device, passive_scalar, precipitation, & 204 205 prho_reference, pt_reference, pt_slope_offset, random_heatflux, & … … 280 281 CHARACTER (LEN=9) :: time_to_string !< 281 282 282 INTEGER(iwp) :: netcdf_data_format_save !<283 284 283 ! 285 284 !-- At the beginning of a simulation determine the time step as well as … … 1048 1047 1049 1048 ! 1050 !-- masked data output 1051 !-- Parallel netcdf output is not tested so far for masked data, hence 1052 !-- netcdf_data_format is switched back to non-paralell output. 1053 netcdf_data_format_save = netcdf_data_format 1054 IF ( netcdf_data_format == 5 ) netcdf_data_format = 3 1055 IF ( netcdf_data_format == 6 ) netcdf_data_format = 4 1049 !-- Masked data output 1056 1050 DO mid = 1, masks 1057 1051 IF ( time_domask(mid) >= dt_domask(mid) ) THEN … … 1061 1055 ENDIF 1062 1056 ENDDO 1063 netcdf_data_format = netcdf_data_format_save1064 1057 1065 1058 ! … … 1071 1064 CALL data_output_2d( 'yz', 1 ) 1072 1065 CALL data_output_3d( 1 ) 1073 !-- Parallel netcdf output is not tested so far for masked data, hence1074 !-- netcdf_data_format is switched back to non-paralell output.1075 netcdf_data_format_save = netcdf_data_format1076 IF ( netcdf_data_format == 5 ) netcdf_data_format = 31077 IF ( netcdf_data_format == 6 ) netcdf_data_format = 41078 1066 DO mid = 1, masks 1079 1067 CALL data_output_mask( 1 ) 1080 1068 ENDDO 1081 netcdf_data_format = netcdf_data_format_save1082 1069 time_do_av = MOD( time_do_av, MAX( dt_data_output_av, dt_3d ) ) 1083 1070 ENDIF -
palm/trunk/SOURCE/user_check_data_output_pr.f90
r1683 r1783 19 19 ! Current revisions: 20 20 ! ----------------- 21 ! 21 ! netcdf module name changed + relatec changes 22 22 ! 23 23 ! Former revisions: … … 57 57 USE kinds 58 58 59 USE netcdf_control 59 USE netcdf_interface, & 60 ONLY: dopr_unit 60 61 61 62 USE profil_parameter -
palm/trunk/SOURCE/user_init.f90
r1683 r1783 19 19 ! Current revisions: 20 20 ! ----------------- 21 ! 21 ! netcdf module name changed + related changes 22 22 ! 23 23 ! Former revisions: … … 55 55 USE kinds 56 56 57 USE netcdf_control 57 USE netcdf_interface, & 58 ONLY: dots_label, dots_unit 58 59 59 60 USE pegrid -
palm/trunk/SOURCE/user_parin.f90
r1683 r1783 19 19 ! Current revisions: 20 20 ! ----------------- 21 ! 21 ! required interface revision changed 22 22 ! 23 23 ! Former revisions: … … 89 89 !-- current revision does not match with previous revisions (e.g. if routines 90 90 !-- have been added/deleted or if parameter lists in subroutines have been changed). 91 user_interface_current_revision = 'r1 663'91 user_interface_current_revision = 'r1783' 92 92 93 93 ! -
palm/trunk/SOURCE/user_statistics.f90
r1683 r1783 19 19 ! Current revisions: 20 20 ! ----------------- 21 ! 21 ! netcdf module name changed + related changes 22 22 ! 23 23 ! Former revisions: … … 66 66 USE kinds 67 67 68 USE netcdf_control 69 68 USE netcdf_interface, & 69 ONLY: dots_max 70 70 71 USE pegrid 71 72 -
palm/trunk/SOURCE/write_var_list.f90
r1706 r1783 19 19 ! Current revisions: 20 20 ! ----------------- 21 ! 21 ! netcdf module name changed + related changes 22 22 ! 23 23 ! Former revisions: … … 155 155 ONLY: damp_level_1d, dt_pr_1d, dt_run_control_1d, end_time_1d 156 156 157 USE netcdf_control 157 USE netcdf_interface, & 158 ONLY: netcdf_precision, output_for_t0 158 159 159 160 USE particle_attributes, &
Note: See TracChangeset
for help on using the changeset viewer.