Changeset 3036 for palm/trunk/SOURCE
- Timestamp:
- May 24, 2018 10:18:26 AM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
palm/trunk/SOURCE/netcdf_data_input_mod.f90
r3019 r3036 25 25 ! ----------------- 26 26 ! $Id$ 27 ! Revision of input vars according to UC2 data standard 28 ! - renamed 'orography_2D' to 'zt' 29 ! - renamed 'buildings_2D' to 'buildings_2d' 30 ! - renamed 'buildings_3D' to 'buildings_3d' 31 ! - renamed 'leaf_are_density' to 'lad' 32 ! - renamed 'basal_are_density' to 'bad' 33 ! - renamed 'root_are_density_lad' to 'root_area_dens_r' 34 ! - renamed 'root_are_density_lsm' to 'root_area_dens_s' 35 ! - renamed 'ls_forcing_ug' to 'tend_ug' 36 ! - renamed 'ls_forcing_vg' to 'tend_vg' 37 ! 38 ! 3019 2018-05-13 07:05:43Z maronga 27 39 ! Improved reading speed of large NetCDF files 28 ! 40 ! 29 41 ! 2963 2018-04-12 14:47:44Z suehring 30 42 ! - Revise checks for static input variables. 31 ! - Introduce index for vegetation/wall, pavement/green-wall and water/window 43 ! - Introduce index for vegetation/wall, pavement/green-wall and water/window 32 44 ! surfaces, for clearer access of surface fraction, albedo, emissivity, etc. . 33 ! 45 ! 34 46 ! 2958 2018-04-11 15:38:13Z suehring 35 47 ! Synchronize longitude and latitude between nested model domains, values are 36 48 ! taken from the root model. 37 ! 49 ! 38 50 ! 2955 2018-04-09 15:14:01Z suehring 39 ! Extend checks for consistent setting of buildings, its ID and type. 51 ! Extend checks for consistent setting of buildings, its ID and type. 40 52 ! Add log-points to measure CPU time of NetCDF data input. 41 ! 53 ! 42 54 ! 2953 2018-04-09 11:26:02Z suehring 43 55 ! Bugfix in checks for initialization data 44 ! 56 ! 45 57 ! 2947 2018-04-04 18:01:41Z suehring 46 58 ! Checks for dynamic input revised 47 ! 59 ! 48 60 ! 2946 2018-04-04 17:01:23Z suehring 49 ! Bugfix for revision 2945, perform checks only if dynamic input file is 61 ! Bugfix for revision 2945, perform checks only if dynamic input file is 50 62 ! available. 51 ! 63 ! 52 64 ! 2945 2018-04-04 16:27:14Z suehring 53 ! - Mimic for topography input slightly revised, in order to enable consistency 65 ! - Mimic for topography input slightly revised, in order to enable consistency 54 66 ! checks 55 67 ! - Add checks for dimensions in dynamic input file and move already existing 56 ! checks 57 ! 68 ! checks 69 ! 58 70 ! 2938 2018-03-27 15:52:42Z suehring 59 ! Initial read of geostrophic wind components from dynamic driver. 60 ! 71 ! Initial read of geostrophic wind components from dynamic driver. 72 ! 61 73 ! 2773 2018-01-30 14:12:54Z suehring 62 74 ! Revise checks for surface_fraction. 63 ! 75 ! 64 76 ! 2925 2018-03-23 14:54:11Z suehring 65 ! Check for further inconsistent settings of surface_fractions. 77 ! Check for further inconsistent settings of surface_fractions. 66 78 ! Some messages slightly rephrased and error numbers renamed. 67 ! 79 ! 68 80 ! 2898 2018-03-15 13:03:01Z suehring 69 ! Check if each building has a type. Further, check if dimensions in static 70 ! input file match the model dimensions. 71 ! 81 ! Check if each building has a type. Further, check if dimensions in static 82 ! input file match the model dimensions. 83 ! 72 84 ! 2897 2018-03-15 11:47:16Z suehring 73 85 ! Relax restrictions for topography input, terrain and building heights can be 74 ! input separately and are not mandatory any more. 75 ! 86 ! input separately and are not mandatory any more. 87 ! 76 88 ! 2874 2018-03-13 10:55:42Z knoop 77 89 ! Bugfix: wrong placement of netcdf cpp-macros fixed 78 ! 90 ! 79 91 ! 2794 2018-02-07 14:09:43Z knoop 80 92 ! Check if 3D building input is consistent to numeric grid. 81 ! 93 ! 82 94 ! 2773 2018-01-30 14:12:54Z suehring 83 95 ! - Enable initialization with 3D topography. 84 96 ! - Move check for correct initialization in nesting mode to check_parameters. 85 ! 97 ! 86 98 ! 2772 2018-01-29 13:10:35Z suehring 87 99 ! Initialization of simulation independent on land-surface model. 88 ! 100 ! 89 101 ! 2746 2018-01-15 12:06:04Z suehring 90 102 ! Read plant-canopy variables independently on land-surface model usage 91 ! 103 ! 92 104 ! 2718 2018-01-02 08:49:38Z maronga 93 105 ! Corrected "Former revisions" section 94 ! 106 ! 95 107 ! 2711 2017-12-20 17:04:49Z suehring 96 ! Rename subroutine close_file to avoid double-naming. 97 ! 108 ! Rename subroutine close_file to avoid double-naming. 109 ! 98 110 ! 2700 2017-12-15 14:12:35Z suehring 99 111 ! 100 112 ! 2696 2017-12-14 17:12:51Z kanani 101 113 ! Initial revision (suehring) 102 ! 103 ! 114 ! 115 ! 104 116 ! 105 117 ! … … 107 119 ! -------- 108 120 ! @author Matthias Suehring 109 ! 121 ! 110 122 ! Description: 111 123 ! ------------ 112 !> Modulue contains routines to input data according to Palm input data 113 !> standart using dynamic and static input files. 124 !> Modulue contains routines to input data according to Palm input data 125 !> standart using dynamic and static input files. 114 126 !> 115 127 !> @todo - Order input alphabetically … … 120 132 !------------------------------------------------------------------------------! 121 133 MODULE netcdf_data_input_mod 122 134 123 135 USE control_parameters, & 124 136 ONLY: coupling_char, io_blocks, io_group … … 138 150 ONLY: ind_pav_green, ind_veg_wall, ind_wat_win 139 151 ! 140 !-- Define type for dimensions. 152 !-- Define type for dimensions. 141 153 TYPE dims_xy 142 154 INTEGER(iwp) :: nx !< dimension length in x … … 149 161 ! 150 162 !-- Define data type for nesting in larger-scale models like COSMO. 151 !-- Data type comprises u, v, w, pt, and q at lateral and top boundaries. 163 !-- Data type comprises u, v, w, pt, and q at lateral and top boundaries. 152 164 TYPE force_type 153 165 … … 206 218 TYPE init_type 207 219 208 INTEGER(iwp) :: lod_msoil !< level of detail - soil moisture 220 INTEGER(iwp) :: lod_msoil !< level of detail - soil moisture 209 221 INTEGER(iwp) :: lod_pt !< level of detail - pt 210 222 INTEGER(iwp) :: lod_q !< level of detail - q 211 INTEGER(iwp) :: lod_tsoil !< level of detail - soil temperature 223 INTEGER(iwp) :: lod_tsoil !< level of detail - soil temperature 212 224 INTEGER(iwp) :: lod_u !< level of detail - u-component 213 225 INTEGER(iwp) :: lod_v !< level of detail - v-component … … 221 233 INTEGER(iwp) :: nzw !< number of vertical levels on w grid in dynamic input file 222 234 223 LOGICAL :: from_file_msoil = .FALSE. !< flag indicating whether soil moisture is already initialized from file 235 LOGICAL :: from_file_msoil = .FALSE. !< flag indicating whether soil moisture is already initialized from file 224 236 LOGICAL :: from_file_pt = .FALSE. !< flag indicating whether pt is already initialized from file 225 LOGICAL :: from_file_q = .FALSE. !< flag indicating whether q is already initialized from file 226 LOGICAL :: from_file_tsoil = .FALSE. !< flag indicating whether soil temperature is already initialized from file 227 LOGICAL :: from_file_u = .FALSE. !< flag indicating whether u is already initialized from file 228 LOGICAL :: from_file_ug = .FALSE. !< flag indicating whether ug is already initialized from file 229 LOGICAL :: from_file_v = .FALSE. !< flag indicating whether v is already initialized from file 230 LOGICAL :: from_file_vg = .FALSE. !< flag indicating whether ug is already initialized from file 237 LOGICAL :: from_file_q = .FALSE. !< flag indicating whether q is already initialized from file 238 LOGICAL :: from_file_tsoil = .FALSE. !< flag indicating whether soil temperature is already initialized from file 239 LOGICAL :: from_file_u = .FALSE. !< flag indicating whether u is already initialized from file 240 LOGICAL :: from_file_ug = .FALSE. !< flag indicating whether ug is already initialized from file 241 LOGICAL :: from_file_v = .FALSE. !< flag indicating whether v is already initialized from file 242 LOGICAL :: from_file_vg = .FALSE. !< flag indicating whether ug is already initialized from file 231 243 LOGICAL :: from_file_w = .FALSE. !< flag indicating whether w is already initialized from file 232 244 … … 262 274 263 275 ! 264 !-- Define data structures for different input data types. 276 !-- Define data structures for different input data types. 265 277 !-- 8-bit Integer 2D 266 278 TYPE int_2d_8bit 267 279 INTEGER(KIND=1) :: fill = -127 !< fill value 268 280 INTEGER(KIND=1), DIMENSION(:,:), ALLOCATABLE :: var !< respective variable 269 270 LOGICAL :: from_file = .FALSE. !< flag indicating whether an input variable is available and read from file or default values are used 281 282 LOGICAL :: from_file = .FALSE. !< flag indicating whether an input variable is available and read from file or default values are used 271 283 END TYPE int_2d_8bit 272 284 ! … … 276 288 INTEGER(iwp), DIMENSION(:,:), ALLOCATABLE :: var !< respective variable 277 289 278 LOGICAL :: from_file = .FALSE. !< flag indicating whether an input variable is available and read from file or default values are used 290 LOGICAL :: from_file = .FALSE. !< flag indicating whether an input variable is available and read from file or default values are used 279 291 END TYPE int_2d_32bit 280 292 … … 282 294 !-- Define data type to read 2D real variables 283 295 TYPE real_2d 284 LOGICAL :: from_file = .FALSE. !< flag indicating whether an input variable is available and read from file or default values are used 296 LOGICAL :: from_file = .FALSE. !< flag indicating whether an input variable is available and read from file or default values are used 285 297 286 298 REAL(wp) :: fill = -9999.9_wp !< fill value … … 291 303 !-- Define data type to read 2D real variables 292 304 TYPE real_3d 293 LOGICAL :: from_file = .FALSE. !< flag indicating whether an input variable is available and read from file or default values are used 294 295 INTEGER(iwp) :: nz !< number of grid points along vertical dimension 305 LOGICAL :: from_file = .FALSE. !< flag indicating whether an input variable is available and read from file or default values are used 306 307 INTEGER(iwp) :: nz !< number of grid points along vertical dimension 296 308 297 309 REAL(wp) :: fill = -9999.9_wp !< fill value … … 299 311 END TYPE real_3d 300 312 ! 301 !-- Define data structure where the dimension and type of the input depends 302 !-- on the given level of detail. 303 !-- For buildings, the input is either 2D float, or 3d byte. 313 !-- Define data structure where the dimension and type of the input depends 314 !-- on the given level of detail. 315 !-- For buildings, the input is either 2D float, or 3d byte. 304 316 TYPE build_in 305 INTEGER(iwp) :: lod = 1 !< level of detail 317 INTEGER(iwp) :: lod = 1 !< level of detail 306 318 INTEGER(KIND=1) :: fill2 = -127 !< fill value for lod = 2 307 319 INTEGER(iwp) :: nz !< number of vertical layers in file … … 310 322 REAL(wp), DIMENSION(:), ALLOCATABLE :: z !< vertical coordinate for 3D building, used for consistency check 311 323 312 LOGICAL :: from_file = .FALSE. !< flag indicating whether an input variable is available and read from file or default values are used 324 LOGICAL :: from_file = .FALSE. !< flag indicating whether an input variable is available and read from file or default values are used 313 325 314 326 REAL(wp) :: fill1 = -9999.9_wp !< fill values for lod = 1 … … 317 329 318 330 ! 319 !-- For soil_type, the input is either 2D or 3D one-byte integer. 331 !-- For soil_type, the input is either 2D or 3D one-byte integer. 320 332 TYPE soil_in 321 INTEGER(iwp) :: lod = 1 !< level of detail 333 INTEGER(iwp) :: lod = 1 !< level of detail 322 334 INTEGER(KIND=1) :: fill = -127 !< fill value for lod = 2 323 335 INTEGER(KIND=1), DIMENSION(:,:), ALLOCATABLE :: var_2d !< 2d variable (lod = 1) 324 336 INTEGER(KIND=1), DIMENSION(:,:,:), ALLOCATABLE :: var_3d !< 3d variable (lod = 2) 325 337 326 LOGICAL :: from_file = .FALSE. !< flag indicating whether an input variable is available and read from file or default values are used 338 LOGICAL :: from_file = .FALSE. !< flag indicating whether an input variable is available and read from file or default values are used 327 339 END TYPE soil_in 328 340 … … 333 345 INTEGER(iwp), DIMENSION(:), ALLOCATABLE :: nfracs !< dimension array for fraction 334 346 335 LOGICAL :: from_file = .FALSE. !< flag indicating whether an input variable is available and read from file or default values are used 347 LOGICAL :: from_file = .FALSE. !< flag indicating whether an input variable is available and read from file or default values are used 336 348 337 349 REAL(wp) :: fill = -9999.9_wp !< fill value … … 339 351 END TYPE fracs 340 352 ! 341 !-- Data type for parameter lists, Depending on the given level of detail, 353 !-- Data type for parameter lists, Depending on the given level of detail, 342 354 !-- the input is 3D or 4D 343 355 TYPE pars … … 345 357 INTEGER(iwp) :: np !< total number of parameters 346 358 INTEGER(iwp) :: nz !< vertical dimension - number of soil layers 347 INTEGER(iwp), DIMENSION(:), ALLOCATABLE :: layers !< dimension array for soil layers 359 INTEGER(iwp), DIMENSION(:), ALLOCATABLE :: layers !< dimension array for soil layers 348 360 INTEGER(iwp), DIMENSION(:), ALLOCATABLE :: pars !< dimension array for parameters 349 361 350 LOGICAL :: from_file = .FALSE. !< flag indicating whether an input variable is available and read from file or default values are used 362 LOGICAL :: from_file = .FALSE. !< flag indicating whether an input variable is available and read from file or default values are used 351 363 352 364 REAL(wp) :: fill = -9999.9_wp !< fill value … … 358 370 TYPE(dims_xy) :: dim_static !< data structure for x, y-dimension in static input file 359 371 360 TYPE(force_type) :: force !< data structure for data input at lateral and top boundaries (provided by Inifor) 372 TYPE(force_type) :: force !< data structure for data input at lateral and top boundaries (provided by Inifor) 361 373 362 374 TYPE(init_type) :: init_3d !< data structure for the initialization of the 3D flow and soil fields 363 TYPE(init_type) :: init_model !< data structure for the initialization of the model 375 TYPE(init_type) :: init_model !< data structure for the initialization of the model 364 376 365 377 ! … … 511 523 ! Description: 512 524 ! ------------ 513 !> Inquires whether NetCDF input files according to Palm-input-data standard 525 !> Inquires whether NetCDF input files according to Palm-input-data standard 514 526 !> exist. Moreover, basic checks are performed. 515 527 !------------------------------------------------------------------------------! … … 531 543 532 544 ! 533 !-- As long as topography can be input via ASCII format, no distinction 545 !-- As long as topography can be input via ASCII format, no distinction 534 546 !-- between building and terrain can be made. This case, classify all 535 547 !-- surfaces as default type. Same in case land-surface and urban-surface 536 548 !-- model are not applied. 537 549 IF ( .NOT. input_pids_static ) THEN 538 topo_no_distinct = .TRUE. 550 topo_no_distinct = .TRUE. 539 551 ENDIF 540 552 … … 553 565 INTEGER(iwp) :: ii !< running index for IO blocks 554 566 555 IF ( .NOT. input_pids_static ) RETURN 567 IF ( .NOT. input_pids_static ) RETURN 556 568 557 569 DO ii = 0, io_blocks-1 … … 579 591 ENDDO 580 592 ! 581 !-- In case of nested runs, each model domain might have different longitude 582 !-- and latitude, which would result in different Coriolis parameters and 583 !-- sun-zenith angles. To avoid this, longitude and latitude in each model 584 !-- domain will be set to the values of the root model. Please note, this 593 !-- In case of nested runs, each model domain might have different longitude 594 !-- and latitude, which would result in different Coriolis parameters and 595 !-- sun-zenith angles. To avoid this, longitude and latitude in each model 596 !-- domain will be set to the values of the root model. Please note, this 585 597 !-- synchronization is required already here. 586 598 #if defined( __parallel ) … … 647 659 TRIM( coupling_char ) , id_surf ) 648 660 ! 649 !-- At first, inquire all variable names. 661 !-- At first, inquire all variable names. 650 662 !-- This will be used to check whether an optional input variable 651 !-- exist or not. 663 !-- exist or not. 652 664 CALL inquire_num_variables( id_surf, num_vars ) 653 665 … … 657 669 ! 658 670 !-- Read leaf area density - resolved vegetation 659 IF ( check_existence( var_names, 'l eaf_area_density' ) ) THEN660 leaf_area_density_f%from_file = .TRUE. 671 IF ( check_existence( var_names, 'lad' ) ) THEN 672 leaf_area_density_f%from_file = .TRUE. 661 673 CALL get_attribute( id_surf, char_fill, & 662 674 leaf_area_density_f%fill, & 663 .FALSE., 'l eaf_area_density' )675 .FALSE., 'lad' ) 664 676 ! 665 677 !-- Inquire number of vertical vegetation layer 666 678 CALL get_dimension_length( id_surf, leaf_area_density_f%nz, & 667 679 'zlad' ) 668 ! 680 ! 669 681 !-- Allocate variable for leaf-area density 670 682 ALLOCATE( leaf_area_density_f%var( & … … 672 684 nys:nyn,nxl:nxr) ) 673 685 674 CALL get_variable( id_surf, 'l eaf_area_density', &686 CALL get_variable( id_surf, 'lad', & 675 687 nxl, nxr, nys, nyn, & 676 688 leaf_area_density_f%var(:,nys:nyn, nxl:nxr) ) 677 689 678 690 ELSE 679 leaf_area_density_f%from_file = .FALSE. 691 leaf_area_density_f%from_file = .FALSE. 680 692 ENDIF 681 693 682 694 ! 683 695 !-- Read basal area density - resolved vegetation 684 IF ( check_existence( var_names, 'ba sal_area_density' ) ) THEN685 basal_area_density_f%from_file = .TRUE. 696 IF ( check_existence( var_names, 'bad' ) ) THEN 697 basal_area_density_f%from_file = .TRUE. 686 698 CALL get_attribute( id_surf, char_fill, & 687 699 basal_area_density_f%fill, & 688 .FALSE., 'ba sal_area_density' )700 .FALSE., 'bad' ) 689 701 ! 690 702 !-- Inquire number of vertical vegetation layer … … 692 704 basal_area_density_f%nz, & 693 705 'zlad' ) 694 ! 706 ! 695 707 !-- Allocate variable 696 708 ALLOCATE( basal_area_density_f%var( & … … 698 710 nys:nyn,nxl:nxr) ) 699 711 700 CALL get_variable( id_surf, 'ba sal_area_density',&712 CALL get_variable( id_surf, 'bad', & 701 713 nxl, nxr, nys, nyn, & 702 714 basal_area_density_f%var(:,nys:nyn, nxl:nxr) ) 703 715 ELSE 704 basal_area_density_f%from_file = .FALSE. 716 basal_area_density_f%from_file = .FALSE. 705 717 ENDIF 706 718 707 719 ! 708 720 !-- Read root area density - resolved vegetation 709 IF ( check_existence( var_names, 'root_area_dens ity_lad' ) ) THEN710 root_area_density_lad_f%from_file = .TRUE. 721 IF ( check_existence( var_names, 'root_area_dens_r' ) ) THEN 722 root_area_density_lad_f%from_file = .TRUE. 711 723 CALL get_attribute( id_surf, char_fill, & 712 724 root_area_density_lad_f%fill, & 713 .FALSE., 'root_area_dens ity_lad' )725 .FALSE., 'root_area_dens_r' ) 714 726 ! 715 727 !-- Inquire number of vertical soil layers … … 717 729 root_area_density_lad_f%nz, & 718 730 'zsoil' ) 719 ! 731 ! 720 732 !-- Allocate variable 721 733 ALLOCATE( root_area_density_lad_f%var & … … 723 735 nys:nyn,nxl:nxr) ) 724 736 725 CALL get_variable( id_surf, 'root_area_dens ity_lad', &726 nxl, nxr, nys, nyn, 737 CALL get_variable( id_surf, 'root_area_dens_r', & 738 nxl, nxr, nys, nyn, & 727 739 root_area_density_lad_f%var(:,nys:nyn, nxl:nxr) ) 728 740 ELSE 729 root_area_density_lad_f%from_file = .FALSE. 741 root_area_density_lad_f%from_file = .FALSE. 730 742 ENDIF 731 743 ! … … 739 751 ENDDO 740 752 ! 741 !-- Deallocate variable list. Will be re-allocated in case further 742 !-- variables are read from file. 753 !-- Deallocate variable list. Will be re-allocated in case further 754 !-- variables are read from file. 743 755 IF ( ALLOCATED( var_names ) ) DEALLOCATE( var_names ) 744 756 745 757 ENDIF 746 758 ! 747 !-- Skip the following if no land-surface or urban-surface module are 748 !-- applied. This case, no one of the following variables is used anyway. 759 !-- Skip the following if no land-surface or urban-surface module are 760 !-- applied. This case, no one of the following variables is used anyway. 749 761 IF ( .NOT. land_surface .OR. .NOT. urban_surface ) RETURN 750 762 ! … … 762 774 763 775 ! 764 !-- Inquire all variable names. 765 !-- This will be used to check whether an optional input variable exist 766 !-- or not. 776 !-- Inquire all variable names. 777 !-- This will be used to check whether an optional input variable exist 778 !-- or not. 767 779 CALL inquire_num_variables( id_surf, num_vars ) 768 780 … … 792 804 !-- Read soil type and required attributes 793 805 IF ( check_existence( var_names, 'soil_type' ) ) THEN 794 soil_type_f%from_file = .TRUE. 806 soil_type_f%from_file = .TRUE. 795 807 ! 796 808 !-- Note, lod is currently not on file; skip for the moment … … 800 812 CALL get_attribute( id_surf, char_fill, & 801 813 soil_type_f%fill, & 802 .FALSE., 'soil_type' ) 814 .FALSE., 'soil_type' ) 803 815 804 816 IF ( soil_type_f%lod == 1 ) THEN … … 808 820 DO i = nxl, nxr 809 821 CALL get_variable( id_surf, 'soil_type', & 810 i, soil_type_f%var_2d(:,i) ) 822 i, soil_type_f%var_2d(:,i) ) 811 823 ENDDO 812 824 ELSEIF ( soil_type_f%lod == 2 ) THEN … … 820 832 DO j = nys, nyn 821 833 CALL get_variable( id_surf, 'soil_type', i, j, & 822 soil_type_f%var_3d(:,j,i) ) 834 soil_type_f%var_3d(:,j,i) ) 823 835 ENDDO 824 ENDDO 836 ENDDO 825 837 ENDIF 826 838 ELSE … … 831 843 !-- Read pavement type and required attributes 832 844 IF ( check_existence( var_names, 'pavement_type' ) ) THEN 833 pavement_type_f%from_file = .TRUE. 845 pavement_type_f%from_file = .TRUE. 834 846 CALL get_attribute( id_surf, char_fill, & 835 847 pavement_type_f%fill, .FALSE., & 836 'pavement_type' ) 848 'pavement_type' ) 837 849 ! 838 850 !-- PE-wise reading of 2D pavement type. … … 840 852 DO i = nxl, nxr 841 853 CALL get_variable( id_surf, 'pavement_type', & 842 i, pavement_type_f%var(:,i) ) 854 i, pavement_type_f%var(:,i) ) 843 855 ENDDO 844 856 ELSE … … 849 861 !-- Read water type and required attributes 850 862 IF ( check_existence( var_names, 'water_type' ) ) THEN 851 water_type_f%from_file = .TRUE. 863 water_type_f%from_file = .TRUE. 852 864 CALL get_attribute( id_surf, char_fill, water_type_f%fill, & 853 865 .FALSE., 'water_type' ) … … 857 869 DO i = nxl, nxr 858 870 CALL get_variable( id_surf, 'water_type', i, & 859 water_type_f%var(:,i) ) 871 water_type_f%var(:,i) ) 860 872 ENDDO 861 873 ELSE … … 865 877 !-- Read surface fractions and related information 866 878 IF ( check_existence( var_names, 'surface_fraction' ) ) THEN 867 surface_fraction_f%from_file = .TRUE. 879 surface_fraction_f%from_file = .TRUE. 868 880 CALL get_attribute( id_surf, char_fill, & 869 881 surface_fraction_f%fill, & … … 874 886 surface_fraction_f%nf, & 875 887 'nsurface_fraction' ) 876 ! 888 ! 877 889 !-- Allocate dimension array and input array for surface fractions 878 890 ALLOCATE( surface_fraction_f%nfracs(0:surface_fraction_f%nf-1) ) … … 889 901 surface_fraction_f%frac(:,nys:nyn, nxl:nxr)) 890 902 ELSE 891 surface_fraction_f%from_file = .FALSE. 903 surface_fraction_f%from_file = .FALSE. 892 904 ENDIF 893 905 ! 894 906 !-- Read building parameters and related information 895 907 IF ( check_existence( var_names, 'building_pars' ) ) THEN 896 building_pars_f%from_file = .TRUE. 908 building_pars_f%from_file = .TRUE. 897 909 CALL get_attribute( id_surf, char_fill, & 898 910 building_pars_f%fill, & 899 .FALSE., 'building_pars' ) 911 .FALSE., 'building_pars' ) 900 912 ! 901 913 !-- Inquire number of building parameters … … 903 915 building_pars_f%np, & 904 916 'nbuilding_pars' ) 905 ! 917 ! 906 918 !-- Allocate dimension array and input array for building parameters 907 919 ALLOCATE( building_pars_f%pars(0:building_pars_f%np-1) ) … … 918 930 building_pars_f%pars_xy(:,nys:nyn, nxl:nxr) ) 919 931 ELSE 920 building_pars_f%from_file = .FALSE. 932 building_pars_f%from_file = .FALSE. 921 933 ENDIF 922 934 … … 924 936 !-- Read albedo type and required attributes 925 937 IF ( check_existence( var_names, 'albedo_type' ) ) THEN 926 albedo_type_f%from_file = .TRUE. 938 albedo_type_f%from_file = .TRUE. 927 939 CALL get_attribute( id_surf, char_fill, albedo_type_f%fill, & 928 .FALSE., 'albedo_type' ) 940 .FALSE., 'albedo_type' ) 929 941 ! 930 942 !-- PE-wise reading of 2D water type. … … 932 944 DO i = nxl, nxr 933 945 CALL get_variable( id_surf, 'albedo_type', & 934 i, albedo_type_f%var(:,i) ) 946 i, albedo_type_f%var(:,i) ) 935 947 ENDDO 936 948 ELSE … … 940 952 !-- Read albedo parameters and related information 941 953 IF ( check_existence( var_names, 'albedo_pars' ) ) THEN 942 albedo_pars_f%from_file = .TRUE. 954 albedo_pars_f%from_file = .TRUE. 943 955 CALL get_attribute( id_surf, char_fill, albedo_pars_f%fill, & 944 .FALSE., 'albedo_pars' ) 956 .FALSE., 'albedo_pars' ) 945 957 ! 946 958 !-- Inquire number of albedo parameters 947 959 CALL get_dimension_length( id_surf, albedo_pars_f%np, & 948 960 'nalbedo_pars' ) 949 ! 961 ! 950 962 !-- Allocate dimension array and input array for albedo parameters 951 963 ALLOCATE( albedo_pars_f%pars(0:albedo_pars_f%np-1) ) … … 959 971 DO j = nys, nyn 960 972 CALL get_variable( id_surf, 'albedo_pars', i, j, & 961 albedo_pars_f%pars_xy(:,j,i) ) 973 albedo_pars_f%pars_xy(:,j,i) ) 962 974 ENDDO 963 975 ENDDO 964 976 ELSE 965 albedo_pars_f%from_file = .FALSE. 977 albedo_pars_f%from_file = .FALSE. 966 978 ENDIF 967 979 … … 969 981 !-- Read pavement parameters and related information 970 982 IF ( check_existence( var_names, 'pavement_pars' ) ) THEN 971 pavement_pars_f%from_file = .TRUE. 983 pavement_pars_f%from_file = .TRUE. 972 984 CALL get_attribute( id_surf, char_fill, & 973 985 pavement_pars_f%fill, & 974 .FALSE., 'pavement_pars' ) 986 .FALSE., 'pavement_pars' ) 975 987 ! 976 988 !-- Inquire number of pavement parameters 977 989 CALL get_dimension_length( id_surf, pavement_pars_f%np, & 978 990 'npavement_pars' ) 979 ! 991 ! 980 992 !-- Allocate dimension array and input array for pavement parameters 981 993 ALLOCATE( pavement_pars_f%pars(0:pavement_pars_f%np-1) ) … … 986 998 CALL get_variable( id_surf, 'npavement_pars', & 987 999 pavement_pars_f%pars ) 988 1000 989 1001 DO i = nxl, nxr 990 1002 DO j = nys, nyn 991 1003 CALL get_variable( id_surf, 'pavement_pars', i, j, & 992 pavement_pars_f%pars_xy(:,j,i) ) 1004 pavement_pars_f%pars_xy(:,j,i) ) 993 1005 ENDDO 994 1006 ENDDO 995 1007 ELSE 996 pavement_pars_f%from_file = .FALSE. 1008 pavement_pars_f%from_file = .FALSE. 997 1009 ENDIF 998 1010 … … 1001 1013 IF ( check_existence( var_names, 'pavement_subsurface_pars' ) ) & 1002 1014 THEN 1003 pavement_subsurface_pars_f%from_file = .TRUE. 1015 pavement_subsurface_pars_f%from_file = .TRUE. 1004 1016 CALL get_attribute( id_surf, char_fill, & 1005 1017 pavement_subsurface_pars_f%fill, & 1006 .FALSE., 'pavement_subsurface_pars' ) 1018 .FALSE., 'pavement_subsurface_pars' ) 1007 1019 ! 1008 1020 !-- Inquire number of parameters … … 1011 1023 'npavement_subsurface_pars' ) 1012 1024 ! 1013 !-- Inquire number of soil layers 1025 !-- Inquire number of soil layers 1014 1026 CALL get_dimension_length( id_surf, & 1015 1027 pavement_subsurface_pars_f%nz, & 1016 1028 'zsoil' ) 1017 ! 1029 ! 1018 1030 !-- Allocate dimension array and input array for pavement parameters 1019 1031 ALLOCATE( pavement_subsurface_pars_f%pars & … … 1027 1039 CALL get_variable( id_surf, 'npavement_subsurface_pars', & 1028 1040 pavement_subsurface_pars_f%pars ) 1029 1041 1030 1042 DO i = nxl, nxr 1031 1043 DO j = nys, nyn … … 1035 1047 pavement_subsurface_pars_f%pars_xyz(:,:,j,i),& 1036 1048 pavement_subsurface_pars_f%nz, & 1037 pavement_subsurface_pars_f%np ) 1049 pavement_subsurface_pars_f%np ) 1038 1050 ENDDO 1039 1051 ENDDO 1040 1052 ELSE 1041 pavement_subsurface_pars_f%from_file = .FALSE. 1053 pavement_subsurface_pars_f%from_file = .FALSE. 1042 1054 ENDIF 1043 1055 … … 1046 1058 !-- Read vegetation parameters and related information 1047 1059 IF ( check_existence( var_names, 'vegetation_pars' ) ) THEN 1048 vegetation_pars_f%from_file = .TRUE. 1060 vegetation_pars_f%from_file = .TRUE. 1049 1061 CALL get_attribute( id_surf, char_fill, & 1050 1062 vegetation_pars_f%fill, & … … 1054 1066 CALL get_dimension_length( id_surf, vegetation_pars_f%np, & 1055 1067 'nvegetation_pars' ) 1056 ! 1068 ! 1057 1069 !-- Allocate dimension array and input array for surface fractions 1058 1070 ALLOCATE( vegetation_pars_f%pars(0:vegetation_pars_f%np-1) ) … … 1068 1080 vegetation_pars_f%pars_xy(:,nys:nyn,nxl:nxr ) ) 1069 1081 ELSE 1070 vegetation_pars_f%from_file = .FALSE. 1082 vegetation_pars_f%from_file = .FALSE. 1071 1083 ENDIF 1072 1084 … … 1074 1086 !-- Read root parameters/distribution and related information 1075 1087 IF ( check_existence( var_names, 'soil_pars' ) ) THEN 1076 soil_pars_f%from_file = .TRUE. 1088 soil_pars_f%from_file = .TRUE. 1077 1089 CALL get_attribute( id_surf, char_fill, & 1078 soil_pars_f%fill, & 1079 .FALSE., 'soil_pars' ) 1090 soil_pars_f%fill, & 1091 .FALSE., 'soil_pars' ) 1080 1092 1081 1093 CALL get_attribute( id_surf, char_lod, & 1082 1094 soil_pars_f%lod, & 1083 .FALSE., 'soil_pars' ) 1095 .FALSE., 'soil_pars' ) 1084 1096 1085 1097 ! … … 1106 1118 ! 1107 1119 !-- Read soil parameters, depending on level of detail 1108 IF ( soil_pars_f%lod == 1 ) THEN 1120 IF ( soil_pars_f%lod == 1 ) THEN 1109 1121 ALLOCATE( soil_pars_f%pars_xy(0:soil_pars_f%np-1, & 1110 nys:nyn,nxl:nxr) ) 1122 nys:nyn,nxl:nxr) ) 1111 1123 DO i = nxl, nxr 1112 1124 DO j = nys, nyn 1113 1125 CALL get_variable( id_surf, 'soil_pars', i, j, & 1114 soil_pars_f%pars_xy(:,j,i) ) 1126 soil_pars_f%pars_xy(:,j,i) ) 1115 1127 ENDDO 1116 1128 ENDDO … … 1124 1136 CALL get_variable( id_surf, 'soil_pars', i, j, & 1125 1137 soil_pars_f%pars_xyz(:,:,j,i), & 1126 soil_pars_f%nz, soil_pars_f%np ) 1138 soil_pars_f%nz, soil_pars_f%np ) 1127 1139 ENDDO 1128 1140 ENDDO 1129 1141 ENDIF 1130 1142 ELSE 1131 soil_pars_f%from_file = .FALSE. 1143 soil_pars_f%from_file = .FALSE. 1132 1144 ENDIF 1133 1145 … … 1135 1147 !-- Read water parameters and related information 1136 1148 IF ( check_existence( var_names, 'water_pars' ) ) THEN 1137 water_pars_f%from_file = .TRUE. 1149 water_pars_f%from_file = .TRUE. 1138 1150 CALL get_attribute( id_surf, char_fill, & 1139 1151 water_pars_f%fill, & 1140 .FALSE., 'water_pars' ) 1152 .FALSE., 'water_pars' ) 1141 1153 ! 1142 1154 !-- Inquire number of water parameters 1143 CALL get_dimension_length( id_surf, & 1155 CALL get_dimension_length( id_surf, & 1144 1156 water_pars_f%np, & 1145 1157 'nwater_pars' ) 1146 ! 1158 ! 1147 1159 !-- Allocate dimension array and input array for water parameters 1148 1160 ALLOCATE( water_pars_f%pars(0:water_pars_f%np-1) ) … … 1156 1168 DO j = nys, nyn 1157 1169 CALL get_variable( id_surf, 'water_pars', i, j, & 1158 water_pars_f%pars_xy(:,j,i) ) 1170 water_pars_f%pars_xy(:,j,i) ) 1159 1171 ENDDO 1160 1172 ENDDO 1161 1173 ELSE 1162 water_pars_f%from_file = .FALSE. 1174 water_pars_f%from_file = .FALSE. 1163 1175 ENDIF 1164 1176 ! 1165 1177 !-- Read root area density - parametrized vegetation 1166 IF ( check_existence( var_names, 'root_area_dens ity_lsm' ) ) THEN1178 IF ( check_existence( var_names, 'root_area_dens_s' ) ) THEN 1167 1179 root_area_density_lsm_f%from_file = .TRUE. 1168 1180 CALL get_attribute( id_surf, char_fill, & 1169 1181 root_area_density_lsm_f%fill, & 1170 .FALSE., 'root_area_dens ity_lsm' )1182 .FALSE., 'root_area_dens_s' ) 1171 1183 ! 1172 1184 !-- Obtain number of soil layers from file and allocate variable … … 1181 1193 DO i = nxl, nxr 1182 1194 DO j = nys, nyn 1183 CALL get_variable( id_surf, 'root_area_dens ity_lsm',&1195 CALL get_variable( id_surf, 'root_area_dens_s', & 1184 1196 i, j, & 1185 root_area_density_lsm_f%var(:,j,i) ) 1197 root_area_density_lsm_f%var(:,j,i) ) 1186 1198 ENDDO 1187 1199 ENDDO … … 1193 1205 !-- Read street type and street crossing 1194 1206 IF ( check_existence( var_names, 'street_type' ) ) THEN 1195 street_type_f%from_file = .TRUE. 1207 street_type_f%from_file = .TRUE. 1196 1208 CALL get_attribute( id_surf, char_fill, & 1197 1209 street_type_f%fill, .FALSE., & 1198 'street_type' ) 1210 'street_type' ) 1199 1211 ! 1200 1212 !-- PE-wise reading of 2D pavement type. … … 1202 1214 DO i = nxl, nxr 1203 1215 CALL get_variable( id_surf, 'street_type', & 1204 i, street_type_f%var(:,i) ) 1216 i, street_type_f%var(:,i) ) 1205 1217 ENDDO 1206 1218 ELSE … … 1209 1221 1210 1222 IF ( check_existence( var_names, 'street_crossing' ) ) THEN 1211 street_crossing_f%from_file = .TRUE. 1223 street_crossing_f%from_file = .TRUE. 1212 1224 CALL get_attribute( id_surf, char_fill, & 1213 1225 street_crossing_f%fill, .FALSE., & 1214 'street_crossing' ) 1226 'street_crossing' ) 1215 1227 ! 1216 1228 !-- PE-wise reading of 2D pavement type. … … 1218 1230 DO i = nxl, nxr 1219 1231 CALL get_variable( id_surf, 'street_crossing', & 1220 i, street_crossing_f%var(:,i) ) 1232 i, street_crossing_f%var(:,i) ) 1221 1233 ENDDO 1222 1234 ELSE … … 1244 1256 !-- MPI datatypes or rewriting exchange_horiz. 1245 1257 !-- Moreover, varialbes will be resized in the following, including ghost 1246 !-- points. 1247 !-- Start with 2D Integer variables. Please note, for 8-bit integer 1258 !-- points. 1259 !-- Start with 2D Integer variables. Please note, for 8-bit integer 1248 1260 !-- variables must be swapt to 32-bit integer before calling exchange_horiz. 1249 1261 IF ( albedo_type_f%from_file ) THEN … … 1294 1306 ! 1295 1307 !-- Exchange 1 ghost point for 3/4-D variables. For the sake of simplicity, 1296 !-- loop further dimensions to use 2D exchange routines. 1308 !-- loop further dimensions to use 2D exchange routines. 1297 1309 !-- This should be revised later by introducing new MPI datatypes. 1298 1310 IF ( soil_type_f%from_file .AND. ALLOCATED( soil_type_f%var_3d ) ) & 1299 1311 THEN 1300 ALLOCATE( var_dum_int_3d(0:nz_soil,nys:nyn,nxl:nxr) ) 1312 ALLOCATE( var_dum_int_3d(0:nz_soil,nys:nyn,nxl:nxr) ) 1301 1313 var_dum_int_3d = soil_type_f%var_3d 1302 1314 DEALLOCATE( soil_type_f%var_3d ) … … 1463 1475 ENDDO 1464 1476 DEALLOCATE( var_dum_real_4d ) 1465 ENDIF 1477 ENDIF 1466 1478 ENDIF 1467 1479 … … 1695 1707 USE indices, & 1696 1708 ONLY: nbgp, nx, nxl, nxr, ny, nyn, nys, nzb, nzt 1697 1709 1698 1710 1699 1711 IMPLICIT NONE … … 1712 1724 INTEGER(iwp), DIMENSION(nys-nbgp:nyn+nbgp,nxl-nbgp:nxr+nbgp) :: var_exchange_int !< dummy variables used to exchange 32-bit Integer arrays 1713 1725 1714 REAL(wp) :: dum !< dummy variable to skip columns while reading topography file 1726 REAL(wp) :: dum !< dummy variable to skip columns while reading topography file 1715 1727 ! 1716 1728 !-- CPU measurement … … 1720 1732 IF ( ii == io_group ) THEN 1721 1733 ! 1722 !-- Input via palm-input data standard 1734 !-- Input via palm-input data standard 1723 1735 IF ( input_pids_static ) THEN 1724 1736 #if defined ( __netcdf ) … … 1726 1738 !-- Open file in read-only mode 1727 1739 CALL open_read_file( TRIM( input_file_static ) // & 1728 TRIM( coupling_char ), id_topo ) 1729 1730 ! 1731 !-- At first, inquire all variable names. 1732 !-- This will be used to check whether an input variable exist 1733 !-- or not. 1740 TRIM( coupling_char ), id_topo ) 1741 1742 ! 1743 !-- At first, inquire all variable names. 1744 !-- This will be used to check whether an input variable exist 1745 !-- or not. 1734 1746 CALL inquire_num_variables( id_topo, num_vars ) 1735 1747 ! … … 1747 1759 ! 1748 1760 !-- Terrain height. First, get variable-related _FillValue attribute 1749 IF ( check_existence( var_names, ' orography_2D' ) ) THEN1750 terrain_height_f%from_file = .TRUE. 1761 IF ( check_existence( var_names, 'zt' ) ) THEN 1762 terrain_height_f%from_file = .TRUE. 1751 1763 CALL get_attribute( id_topo, char_fill, & 1752 1764 terrain_height_f%fill, & 1753 .FALSE., ' orography_2D' )1765 .FALSE., 'zt' ) 1754 1766 ! 1755 1767 !-- PE-wise reading of 2D terrain height. 1756 1768 ALLOCATE ( terrain_height_f%var(nys:nyn,nxl:nxr) ) 1757 1769 DO i = nxl, nxr 1758 CALL get_variable( id_topo, ' orography_2D',&1759 i, terrain_height_f%var(:,i) ) 1770 CALL get_variable( id_topo, 'zt', & 1771 i, terrain_height_f%var(:,i) ) 1760 1772 ENDDO 1761 1773 ELSE 1762 terrain_height_f%from_file = .FALSE. 1763 ENDIF 1764 1765 ! 1766 !-- Read building height. First, read its _FillValue attribute, 1774 terrain_height_f%from_file = .FALSE. 1775 ENDIF 1776 1777 ! 1778 !-- Read building height. First, read its _FillValue attribute, 1767 1779 !-- as well as lod attribute 1768 buildings_f%from_file = .FALSE. 1769 IF ( check_existence( var_names, 'buildings_2 D' ) ) THEN1770 buildings_f%from_file = .TRUE. 1780 buildings_f%from_file = .FALSE. 1781 IF ( check_existence( var_names, 'buildings_2d' ) ) THEN 1782 buildings_f%from_file = .TRUE. 1771 1783 CALL get_attribute( id_topo, char_lod, buildings_f%lod, & 1772 .FALSE., 'buildings_2 D' )1784 .FALSE., 'buildings_2d' ) 1773 1785 1774 1786 CALL get_attribute( id_topo, char_fill, & 1775 1787 buildings_f%fill1, & 1776 .FALSE., 'buildings_2 D' )1788 .FALSE., 'buildings_2d' ) 1777 1789 1778 1790 ! … … 1781 1793 ALLOCATE ( buildings_f%var_2d(nys:nyn,nxl:nxr) ) 1782 1794 DO i = nxl, nxr 1783 CALL get_variable( id_topo, 'buildings_2 D', &1784 i, buildings_f%var_2d(:,i) ) 1795 CALL get_variable( id_topo, 'buildings_2d', & 1796 i, buildings_f%var_2d(:,i) ) 1785 1797 ENDDO 1786 ELSE 1798 ELSE 1787 1799 message_string = 'NetCDF attribute lod ' // & 1788 1800 '(level of detail) is not set ' // & 1789 'properly for buildings_2 D.'1801 'properly for buildings_2d.' 1790 1802 CALL message( 'netcdf_data_input_mod', 'NDI000', & 1791 1803 1, 2, 0, 6, 0 ) … … 1795 1807 !-- If available, also read 3D building information. If both are 1796 1808 !-- available, use 3D information. 1797 IF ( check_existence( var_names, 'buildings_3 D' ) ) THEN1798 buildings_f%from_file = .TRUE. 1809 IF ( check_existence( var_names, 'buildings_3d' ) ) THEN 1810 buildings_f%from_file = .TRUE. 1799 1811 CALL get_attribute( id_topo, char_lod, buildings_f%lod, & 1800 .FALSE., 'buildings_3 D' )1812 .FALSE., 'buildings_3d' ) 1801 1813 1802 1814 CALL get_attribute( id_topo, char_fill, & 1803 1815 buildings_f%fill2, & 1804 .FALSE., 'buildings_3 D' )1816 .FALSE., 'buildings_3d' ) 1805 1817 1806 1818 CALL get_dimension_length( id_topo, buildings_f%nz, 'z' ) 1807 1819 1808 1820 IF ( buildings_f%lod == 2 ) THEN 1809 1821 ALLOCATE( buildings_f%z(nzb:buildings_f%nz-1) ) … … 1817 1829 DO i = nxl, nxr 1818 1830 DO j = nys, nyn 1819 CALL get_variable( id_topo, 'buildings_3 D', &1831 CALL get_variable( id_topo, 'buildings_3d', & 1820 1832 i, j, & 1821 1833 buildings_f%var_3d(:,j,i) ) 1822 1834 ENDDO 1823 1835 ENDDO 1824 ELSE 1836 ELSE 1825 1837 message_string = 'NetCDF attribute lod ' // & 1826 1838 '(level of detail) is not set ' // & 1827 'properly for buildings_3 D.'1839 'properly for buildings_3d.' 1828 1840 CALL message( 'netcdf_data_input_mod', 'NDI001', & 1829 1841 1, 2, 0, 6, 0 ) … … 1831 1843 ENDIF 1832 1844 ! 1833 !-- Read building IDs and its FillValue attribute. Further required 1845 !-- Read building IDs and its FillValue attribute. Further required 1834 1846 !-- for mapping buildings on top of orography. 1835 1847 IF ( check_existence( var_names, 'building_id' ) ) THEN 1836 building_id_f%from_file = .TRUE. 1848 building_id_f%from_file = .TRUE. 1837 1849 CALL get_attribute( id_topo, char_fill, & 1838 1850 building_id_f%fill, .FALSE., & 1839 1851 'building_id' ) 1840 1852 1841 1853 1842 1854 ALLOCATE ( building_id_f%var(nys:nyn,nxl:nxr) ) 1843 1855 DO i = nxl, nxr 1844 1856 CALL get_variable( id_topo, 'building_id', & 1845 i, building_id_f%var(:,i) ) 1857 i, building_id_f%var(:,i) ) 1846 1858 ENDDO 1847 1859 ELSE 1848 building_id_f%from_file = .FALSE. 1849 ENDIF 1850 ! 1851 !-- Read building_type and required attributes. 1860 building_id_f%from_file = .FALSE. 1861 ENDIF 1862 ! 1863 !-- Read building_type and required attributes. 1852 1864 IF ( check_existence( var_names, 'building_type' ) ) THEN 1853 building_type_f%from_file = .TRUE. 1865 building_type_f%from_file = .TRUE. 1854 1866 CALL get_attribute( id_topo, char_fill, & 1855 1867 building_type_f%fill, .FALSE., & 1856 'building_type' ) 1857 1868 'building_type' ) 1869 1858 1870 ALLOCATE ( building_type_f%var(nys:nyn,nxl:nxr) ) 1859 1871 DO i = nxl, nxr … … 1882 1894 skip_n_rows = 0 1883 1895 DO WHILE ( skip_n_rows < ny - nyn ) 1884 READ( 90, * ) 1896 READ( 90, * ) 1885 1897 skip_n_rows = skip_n_rows + 1 1886 1898 ENDDO 1887 1899 ! 1888 !-- Read data from nyn to nys and nxl to nxr. Therefore, skip 1900 !-- Read data from nyn to nys and nxl to nxr. Therefore, skip 1889 1901 !-- column until nxl-1 is reached 1890 1902 ALLOCATE ( buildings_f%var_2d(nys:nyn,nxl:nxr) ) … … 1896 1908 1897 1909 GOTO 12 1898 1910 1899 1911 10 message_string = 'file TOPOGRAPHY'//TRIM( coupling_char )// & 1900 1912 ' does not exist' … … 1908 1920 buildings_f%from_file = .TRUE. 1909 1921 1910 ENDIF 1922 ENDIF 1911 1923 1912 1924 ENDIF … … 1920 1932 ! 1921 1933 !-- Check for minimum requirement to setup building topography. If buildings 1922 !-- are provided, also an ID and a type are required. 1923 !-- Note, doing this check in check_parameters 1934 !-- are provided, also an ID and a type are required. 1935 !-- Note, doing this check in check_parameters 1924 1936 !-- will be too late (data will be used for grid inititialization before). 1925 1937 IF ( input_pids_static ) THEN 1926 1938 IF ( buildings_f%from_file .AND. & 1927 .NOT. building_id_f%from_file ) THEN 1939 .NOT. building_id_f%from_file ) THEN 1928 1940 message_string = 'If building heigths are prescribed in ' // & 1929 1941 'static input file, also an ID is required.' … … 1932 1944 ENDIF 1933 1945 ! 1934 !-- In case no terrain height is provided by static input file, allocate 1935 !-- array nevertheless and set terrain height to 0, which simplifies 1946 !-- In case no terrain height is provided by static input file, allocate 1947 !-- array nevertheless and set terrain height to 0, which simplifies 1936 1948 !-- topography initialization. 1937 1949 IF ( .NOT. terrain_height_f%from_file ) THEN … … 1940 1952 ENDIF 1941 1953 ! 1942 !-- Finally, exchange 1 ghost point for building ID and type. 1954 !-- Finally, exchange 1 ghost point for building ID and type. 1943 1955 !-- In case of non-cyclic boundary conditions set Neumann conditions at the 1944 1956 !-- lateral boundaries. … … 1956 1968 ENDIF 1957 1969 IF ( .NOT. bc_lr_cyc ) THEN 1958 IF ( nxl == 0 ) building_id_f%var(:,-1) = building_id_f%var(:,0) 1959 IF ( nxr == nx ) building_id_f%var(:,nx+1) = building_id_f%var(:,nx) 1970 IF ( nxl == 0 ) building_id_f%var(:,-1) = building_id_f%var(:,0) 1971 IF ( nxr == nx ) building_id_f%var(:,nx+1) = building_id_f%var(:,nx) 1960 1972 ENDIF 1961 1973 ENDIF … … 1975 1987 ENDIF 1976 1988 IF ( .NOT. bc_lr_cyc ) THEN 1977 IF ( nxl == 0 ) building_type_f%var(:,-1) = building_type_f%var(:,0) 1978 IF ( nxr == nx ) building_type_f%var(:,nx+1) = building_type_f%var(:,nx) 1989 IF ( nxl == 0 ) building_type_f%var(:,-1) = building_type_f%var(:,0) 1990 IF ( nxr == nx ) building_type_f%var(:,nx+1) = building_type_f%var(:,nx) 1979 1991 ENDIF 1980 1992 ENDIF … … 1986 1998 ! ------------ 1987 1999 !> Reads initialization data of u, v, w, pt, q, geostrophic wind components, 1988 !> as well as soil moisture and soil temperature, derived from larger-scale 2000 !> as well as soil moisture and soil temperature, derived from larger-scale 1989 2001 !> model (COSMO) by Inifor. 1990 2002 !------------------------------------------------------------------------------! … … 2014 2026 INTEGER(iwp) :: off_j !< offset in y-direction used for reading the v-component 2015 2027 2016 LOGICAL :: check_passed !< flag indicating if a check passed 2028 LOGICAL :: check_passed !< flag indicating if a check passed 2017 2029 2018 2030 ! … … 2021 2033 ! 2022 2034 !-- Please note, Inifor is designed to provide initial data for u and v for 2023 !-- the prognostic grid points in case of lateral Dirichlet conditions. 2024 !-- This means that Inifor provides data from nxlu:nxr (for u) and 2035 !-- the prognostic grid points in case of lateral Dirichlet conditions. 2036 !-- This means that Inifor provides data from nxlu:nxr (for u) and 2025 2037 !-- from nysv:nyn (for v) at the left and south domain boundary, respectively. 2026 !-- However, as work-around for the moment, PALM will run with cyclic 2027 !-- conditions and will be initialized with data provided by Inifor 2028 !-- boundaries in case of Dirichlet. 2038 !-- However, as work-around for the moment, PALM will run with cyclic 2039 !-- conditions and will be initialized with data provided by Inifor 2040 !-- boundaries in case of Dirichlet. 2029 2041 !-- Hence, simply set set nxlu/nysv to 1 (will be reset to its original value 2030 2042 !-- at the end of this routine. 2031 IF ( bc_lr_cyc .AND. nxl == 0 ) nxlu = 1 2043 IF ( bc_lr_cyc .AND. nxl == 0 ) nxlu = 1 2032 2044 IF ( bc_ns_cyc .AND. nys == 0 ) nysv = 1 2033 2045 … … 2042 2054 !-- Open file in read-only mode 2043 2055 CALL open_read_file( TRIM( input_file_dynamic ) // & 2044 TRIM( coupling_char ), id_dynamic ) 2045 2046 ! 2047 !-- At first, inquire all variable names. 2056 TRIM( coupling_char ), id_dynamic ) 2057 2058 ! 2059 !-- At first, inquire all variable names. 2048 2060 CALL inquire_num_variables( id_dynamic, num_vars ) 2049 2061 ! … … 2053 2065 ! 2054 2066 !-- Read vertical dimension of scalar und w grid. Will be used for 2055 !-- inter- and extrapolation in case of stretched numeric grid. 2067 !-- inter- and extrapolation in case of stretched numeric grid. 2056 2068 !-- This will be removed when Inifor is able to handle stretched grids. 2057 2069 CALL get_dimension_length( id_dynamic, init_3d%nzu, 'z' ) … … 2060 2072 ! 2061 2073 !-- Read also the horizontal dimensions. These are used just used fo 2062 !-- checking the compatibility with the PALM grid before reading. 2074 !-- checking the compatibility with the PALM grid before reading. 2063 2075 CALL get_dimension_length( id_dynamic, init_3d%nx, 'x' ) 2064 2076 CALL get_dimension_length( id_dynamic, init_3d%nxu, 'xu' ) … … 2068 2080 ! 2069 2081 !-- Check for correct horizontal and vertical dimension. Please note, 2070 !-- checks are performed directly here and not called from 2071 !-- check_parameters as some varialbes are still not allocated there. 2072 !-- Moreover, please note, u- and v-grid has 1 grid point less on 2073 !-- Inifor grid. 2082 !-- checks are performed directly here and not called from 2083 !-- check_parameters as some varialbes are still not allocated there. 2084 !-- Moreover, please note, u- and v-grid has 1 grid point less on 2085 !-- Inifor grid. 2074 2086 IF ( init_3d%nx-1 /= nx .OR. init_3d%nxu-1 /= nx - 1 .OR. & 2075 2087 init_3d%ny-1 /= ny .OR. init_3d%nyv-1 /= ny - 1 ) THEN … … 2102 2114 ENDIF 2103 2115 ! 2104 !-- Read initial geostrophic wind components at 2105 !-- t = 0 (index 1 in file). 2106 IF ( check_existence( var_names, ' ls_forcing_ug' ) ) THEN2116 !-- Read initial geostrophic wind components at 2117 !-- t = 0 (index 1 in file). 2118 IF ( check_existence( var_names, 'tend_ug' ) ) THEN 2107 2119 ALLOCATE( init_3d%ug_init(nzb:nzt+1) ) 2108 CALL get_variable_pr( id_dynamic, ' ls_forcing_ug', 1,&2120 CALL get_variable_pr( id_dynamic, 'tend_ug', 1, & 2109 2121 init_3d%ug_init ) 2110 2122 init_3d%from_file_ug = .TRUE. … … 2112 2124 init_3d%from_file_ug = .FALSE. 2113 2125 ENDIF 2114 IF ( check_existence( var_names, ' ls_forcing_vg' ) ) THEN2126 IF ( check_existence( var_names, 'tend_vg' ) ) THEN 2115 2127 ALLOCATE( init_3d%vg_init(nzb:nzt+1) ) 2116 CALL get_variable_pr( id_dynamic, ' ls_forcing_vg', 1,&2128 CALL get_variable_pr( id_dynamic, 'tend_vg', 1, & 2117 2129 init_3d%vg_init ) 2118 2130 init_3d%from_file_vg = .TRUE. … … 2121 2133 ENDIF 2122 2134 ! 2123 !-- Read inital 3D data of u, v, w, pt and q, 2135 !-- Read inital 3D data of u, v, w, pt and q, 2124 2136 !-- derived from COSMO model. Read PE-wise yz-slices. 2125 !-- Please note, the u-, v- and w-component are defined on different 2137 !-- Please note, the u-, v- and w-component are defined on different 2126 2138 !-- grids with one element less in the x-, y-, 2127 2139 !-- and z-direction, respectively. Hence, reading is subdivided 2128 !-- into separate loops. Moreover, i and j are used 2140 !-- into separate loops. Moreover, i and j are used 2129 2141 !-- as start index in the NF90 interface. 2130 !-- The passed arguments for u, and v are (i,j)-1, respectively, 2142 !-- The passed arguments for u, and v are (i,j)-1, respectively, 2131 2143 !-- in contrast to the remaining quantities. This is because in case 2132 !-- of forcing is applied, the input data for u and v has one 2133 !-- element less along the x- and y-direction respectively. 2144 !-- of forcing is applied, the input data for u and v has one 2145 !-- element less along the x- and y-direction respectively. 2134 2146 !-- Read u-component 2135 2147 IF ( check_existence( var_names, 'init_u' ) ) THEN … … 2152 2164 ELSEIF ( init_3d%lod_u == 2 ) THEN 2153 2165 ! 2154 !-- Set offset value. In case of Dirichlet conditions at the left 2155 !-- domain boundary, the u component starts at nxl+1. This case, 2166 !-- Set offset value. In case of Dirichlet conditions at the left 2167 !-- domain boundary, the u component starts at nxl+1. This case, 2156 2168 !-- the passed start-index for reading the NetCDF data is shifted 2157 !-- by -1. 2169 !-- by -1. 2158 2170 off_i = 1 !MERGE( 1, 0, forcing ) 2159 2171 2160 2172 DO i = nxlu, nxr 2161 DO j = nys, nyn 2173 DO j = nys, nyn 2162 2174 CALL get_variable( id_dynamic, 'init_u', i-off_i, j, & 2163 2175 u(nzb+1:nzt+1,j,i) ) … … 2190 2202 ELSEIF ( init_3d%lod_v == 2 ) THEN 2191 2203 ! 2192 !-- Set offset value. In case of Dirichlet conditions at the south 2193 !-- domain boundary, the v component starts at nys+1. This case, 2204 !-- Set offset value. In case of Dirichlet conditions at the south 2205 !-- domain boundary, the v component starts at nys+1. This case, 2194 2206 !-- the passed start-index for reading the NetCDF data is shifted 2195 !-- by -1. 2207 !-- by -1. 2196 2208 off_j = 1 !MERGE( 1, 0, forcing ) 2197 2209 2198 2210 DO i = nxl, nxr 2199 DO j = nysv, nyn 2211 DO j = nysv, nyn 2200 2212 CALL get_variable( id_dynamic, 'init_v', i, j-off_j, & 2201 2213 v(nzb+1:nzt+1,j,i) ) … … 2239 2251 ! 2240 2252 !-- Read potential temperature 2241 IF ( .NOT. neutral ) THEN 2242 IF ( check_existence( var_names, 'init_pt' ) ) THEN 2253 IF ( .NOT. neutral ) THEN 2254 IF ( check_existence( var_names, 'init_pt' ) ) THEN 2243 2255 ! 2244 2256 !-- Read attributes for the fill value and level-of-detail … … 2267 2279 ENDDO 2268 2280 2269 ENDIF 2281 ENDIF 2270 2282 init_3d%from_file_pt = .TRUE. 2271 2283 ENDIF … … 2385 2397 CALL cpu_log( log_point_s(85), 'NetCDF input init', 'stop' ) 2386 2398 ! 2387 !-- Finally, check if the input data has any fill values. Please note, 2399 !-- Finally, check if the input data has any fill values. Please note, 2388 2400 !-- checks depend on the LOD of the input data. 2389 2401 IF ( init_3d%from_file_u ) THEN … … 2468 2480 ! 2469 2481 !-- Workaround for cyclic conditions. Please see above for further explanation. 2470 IF ( bc_lr_cyc .AND. nxl == 0 ) nxlu = nxl 2482 IF ( bc_lr_cyc .AND. nxl == 0 ) nxlu = nxl 2471 2483 IF ( bc_ns_cyc .AND. nys == 0 ) nysv = nys 2472 2484 … … 2476 2488 ! Description: 2477 2489 ! ------------ 2478 !> Reads data at lateral and top boundaries derived from larger-scale model 2490 !> Reads data at lateral and top boundaries derived from larger-scale model 2479 2491 !> (COSMO) by Inifor. 2480 2492 !------------------------------------------------------------------------------! … … 2501 2513 INTEGER(iwp) :: t !< running index time dimension 2502 2514 2503 REAL(wp) :: dum !< dummy variable to skip columns while reading topography file 2504 2505 force%from_file = MERGE( .TRUE., .FALSE., input_pids_dynamic ) 2515 REAL(wp) :: dum !< dummy variable to skip columns while reading topography file 2516 2517 force%from_file = MERGE( .TRUE., .FALSE., input_pids_dynamic ) 2506 2518 ! 2507 2519 !-- Skip input if no forcing from larger-scale models is applied. … … 2518 2530 !-- Open file in read-only mode 2519 2531 CALL open_read_file( TRIM( input_file_dynamic ) // & 2520 TRIM( coupling_char ), id_dynamic ) 2521 ! 2522 !-- Initialize INIFOR forcing. 2532 TRIM( coupling_char ), id_dynamic ) 2533 ! 2534 !-- Initialize INIFOR forcing. 2523 2535 IF ( .NOT. force%init ) THEN 2524 2536 ! 2525 !-- At first, inquire all variable names. 2537 !-- At first, inquire all variable names. 2526 2538 CALL inquire_num_variables( id_dynamic, num_vars ) 2527 2539 ! … … 2567 2579 2568 2580 ! 2569 !-- Obtain time index for current input starting at 0. 2570 !-- @todo: At the moment time, in INIFOR and simulated time correspond 2571 !-- to each other. If required, adjust to daytime. 2581 !-- Obtain time index for current input starting at 0. 2582 !-- @todo: At the moment time, in INIFOR and simulated time correspond 2583 !-- to each other. If required, adjust to daytime. 2572 2584 force%tind = MINLOC( ABS( force%time - simulated_time ), DIM = 1 )& 2573 2585 - 1 … … 2578 2590 IF ( bc_lr_cyc .AND. bc_ns_cyc ) THEN 2579 2591 DO t = force%tind, force%tind_p 2580 CALL get_variable_pr( id_dynamic, ' ls_forcing_ug', t+1,&2592 CALL get_variable_pr( id_dynamic, 'tend_ug', t+1, & 2581 2593 force%ug(t-force%tind,:) ) 2582 CALL get_variable_pr( id_dynamic, ' ls_forcing_vg', t+1,&2594 CALL get_variable_pr( id_dynamic, 'tend_vg', t+1, & 2583 2595 force%ug(t-force%tind,:) ) 2584 2596 ENDDO 2585 ENDIF 2586 ! 2587 !-- Read data at lateral and top boundaries. Please note, at left and 2588 !-- right domain boundary, yz-layers are read for u, v, w, pt and q. 2597 ENDIF 2598 ! 2599 !-- Read data at lateral and top boundaries. Please note, at left and 2600 !-- right domain boundary, yz-layers are read for u, v, w, pt and q. 2589 2601 !-- For the v-component, the data starts at nysv, while for the other 2590 !-- quantities the data starts at nys. This is equivalent at the north 2591 !-- and south domain boundary for the u-component. 2602 !-- quantities the data starts at nys. This is equivalent at the north 2603 !-- and south domain boundary for the u-component. 2592 2604 !-- The function get_variable_bc assumes the start indices with respect 2593 !-- to the netcdf file convention (data starts at index 1). For this 2594 !-- reason, nys+1 / nxl+1 are passed instead of nys / nxl. For the 2605 !-- to the netcdf file convention (data starts at index 1). For this 2606 !-- reason, nys+1 / nxl+1 are passed instead of nys / nxl. For the 2595 2607 !-- the u- and v-component at the north/south, and left/right boundary, 2596 !-- nxlu and nysv are passed, respectively, since these always starts 2597 !-- at index 1 in case of forcing. 2608 !-- nxlu and nysv are passed, respectively, since these always starts 2609 !-- at index 1 in case of forcing. 2598 2610 2599 2611 IF ( force_bound_l ) THEN … … 2881 2893 2882 2894 ! 2883 !-- Finally, after data input set control flag indicating that vertical 2884 !-- inter- and/or extrapolation is required. 2885 !-- Please note, inter/extrapolation of INIFOR data is only a workaroud, 2886 !-- as long as INIFOR delivers vertically equidistant data. 2887 force%interpolated = .FALSE. 2895 !-- Finally, after data input set control flag indicating that vertical 2896 !-- inter- and/or extrapolation is required. 2897 !-- Please note, inter/extrapolation of INIFOR data is only a workaroud, 2898 !-- as long as INIFOR delivers vertically equidistant data. 2899 force%interpolated = .FALSE. 2888 2900 2889 2901 END SUBROUTINE netcdf_data_input_lsf … … 2911 2923 ! 2912 2924 !-- Dynamic input file must also be present if initialization via inifor is 2913 !-- prescribed. 2925 !-- prescribed. 2914 2926 IF ( .NOT. input_pids_dynamic .AND. & 2915 2927 TRIM( initializing_actions ) == 'inifor' ) THEN … … 2947 2959 INTEGER(iwp) :: n_surf !< number of different surface types at given location 2948 2960 2949 LOGICAL :: check_passed !< flag indicating if a check passed 2961 LOGICAL :: check_passed !< flag indicating if a check passed 2950 2962 2951 2963 ! … … 2961 2973 ENDIF 2962 2974 ! 2963 !-- Check if grid spacing of provided input data matches the respective 2964 !-- grid spacing in the model. 2975 !-- Check if grid spacing of provided input data matches the respective 2976 !-- grid spacing in the model. 2965 2977 IF ( dim_static%x(1) - dim_static%x(0) /= dx .OR. & 2966 2978 dim_static%y(1) - dim_static%y(0) /= dy ) THEN … … 2973 2985 !-- Check orography for fill-values. For the moment, give an error message. 2974 2986 !-- More advanced methods, e.g. a nearest neighbor algorithm as used in GIS 2975 !-- systems might be implemented later. 2976 !-- Please note, if no terrain height is provided, it is set to 0. 2987 !-- systems might be implemented later. 2988 !-- Please note, if no terrain height is provided, it is set to 0. 2977 2989 IF ( ANY( terrain_height_f%var == terrain_height_f%fill ) ) THEN 2978 message_string = 'NetCDF variable orography_2D is not ' //&2990 message_string = 'NetCDF variable zt is not ' // & 2979 2991 'allowed to have missing data' 2980 2992 CALL message( 'netcdf_data_input_mod', 'NDI013', 2, 2, 0, 6, 0 ) 2981 2993 ENDIF 2982 2994 ! 2983 !-- If 3D buildings are read, check if building information is consistent 2984 !-- to numeric grid. 2995 !-- If 3D buildings are read, check if building information is consistent 2996 !-- to numeric grid. 2985 2997 IF ( buildings_f%from_file ) THEN 2986 2998 IF ( buildings_f%lod == 2 ) THEN 2987 2999 IF ( buildings_f%nz > SIZE( zu ) ) THEN 2988 3000 message_string = 'Reading 3D building data - too much ' // & 2989 'data points along the vertical coordinate.' 3001 'data points along the vertical coordinate.' 2990 3002 CALL message( 'netcdf_data_input_mod', 'NDI014', 2, 2, 0, 6, 0 ) 2991 3003 ENDIF … … 3003 3015 !-- Skip further checks concerning buildings and natural surface properties 3004 3016 !-- if no urban surface and land surface model are applied. 3005 IF ( .NOT. land_surface .OR. .NOT. urban_surface ) RETURN 3017 IF ( .NOT. land_surface .OR. .NOT. urban_surface ) RETURN 3006 3018 ! 3007 3019 !-- Check for minimum requirement of surface-classification data in case … … 3017 3029 'soil_type and water_type are '// & 3018 3030 'required. If urban-surface model is applied, ' // & 3019 'also building_type ist required' 3031 'also building_type ist required' 3020 3032 CALL message( 'netcdf_data_input_mod', 'NDI016', 1, 2, 0, 6, 0 ) 3021 3033 ENDIF 3022 3034 ! 3023 3035 !-- Check for general availability of input variables. 3024 !-- If vegetation_type is 0 at any location, vegetation_pars as well as 3025 !-- root_area_dens ity_lsmare required.3036 !-- If vegetation_type is 0 at any location, vegetation_pars as well as 3037 !-- root_area_dens_s are required. 3026 3038 IF ( vegetation_type_f%from_file ) THEN 3027 3039 IF ( ANY( vegetation_type_f%var == 0 ) ) THEN … … 3033 3045 IF ( .NOT. root_area_density_lsm_f%from_file ) THEN 3034 3046 message_string = 'If vegegation_type = 0 at any location, ' // & 3035 'root_area_dens ity_lsmis required'3047 'root_area_dens_s is required' 3036 3048 CALL message( 'netcdf_data_input_mod', 'NDI018', 2, 2, 0, 6, 0 ) 3037 3049 ENDIF … … 3041 3053 !-- If soil_type is zero at any location, soil_pars is required. 3042 3054 IF ( soil_type_f%from_file ) THEN 3043 check_passed = .TRUE. 3055 check_passed = .TRUE. 3044 3056 IF ( ALLOCATED( soil_type_f%var_2d ) ) THEN 3045 3057 IF ( ANY( soil_type_f%var_2d == 0 ) ) THEN … … 3054 3066 message_string = 'If soil_type = 0 at any location, ' // & 3055 3067 'soil_pars is required' 3056 CALL message( 'netcdf_data_input_mod', 'NDI019', 2, 2, 0, 6, 0 ) 3068 CALL message( 'netcdf_data_input_mod', 'NDI019', 2, 2, 0, 6, 0 ) 3057 3069 ENDIF 3058 3070 ENDIF … … 3064 3076 message_string = 'If building_type = 0 at any location, ' // & 3065 3077 'building_pars is required' 3066 CALL message( 'netcdf_data_input_mod', 'NDI020', 2, 2, 0, 6, 0 ) 3078 CALL message( 'netcdf_data_input_mod', 'NDI020', 2, 2, 0, 6, 0 ) 3067 3079 ENDIF 3068 3080 ENDIF … … 3075 3087 message_string = 'If albedo_type = 0 at any location, ' // & 3076 3088 'albedo_pars is required' 3077 CALL message( 'netcdf_data_input_mod', 'NDI021', 2, 2, 0, 6, 0 ) 3078 ENDIF 3089 CALL message( 'netcdf_data_input_mod', 'NDI021', 2, 2, 0, 6, 0 ) 3090 ENDIF 3079 3091 ENDIF 3080 3092 ENDIF … … 3086 3098 message_string = 'If pavement_type = 0 at any location, ' // & 3087 3099 'pavement_pars is required' 3088 CALL message( 'netcdf_data_input_mod', 'NDI022', 2, 2, 0, 6, 0 ) 3089 ENDIF 3100 CALL message( 'netcdf_data_input_mod', 'NDI022', 2, 2, 0, 6, 0 ) 3101 ENDIF 3090 3102 ENDIF 3091 3103 ENDIF … … 3098 3110 message_string = 'If pavement_type = 0 at any location, ' // & 3099 3111 'pavement_subsurface_pars is required' 3100 CALL message( 'netcdf_data_input_mod', 'NDI023', 2, 2, 0, 6, 0 ) 3101 ENDIF 3112 CALL message( 'netcdf_data_input_mod', 'NDI023', 2, 2, 0, 6, 0 ) 3113 ENDIF 3102 3114 ENDIF 3103 3115 ENDIF … … 3109 3121 message_string = 'If water_type = 0 at any location, ' // & 3110 3122 'water_pars is required' 3111 CALL message( 'netcdf_data_input_mod', 'NDI024', 2, 2, 0, 6, 0 ) 3112 ENDIF 3123 CALL message( 'netcdf_data_input_mod', 'NDI024', 2, 2, 0, 6, 0 ) 3124 ENDIF 3113 3125 ENDIF 3114 3126 ENDIF … … 3118 3130 DO j = nys, nyn 3119 3131 ! 3120 !-- For each (y,x)-location at least one of the parameters 3132 !-- For each (y,x)-location at least one of the parameters 3121 3133 !-- vegetation_type, pavement_type, building_type, or water_type 3122 3134 !-- must be set to a nonÂmissing value. … … 3132 3144 ENDIF 3133 3145 ! 3134 !-- Note that a soil_type is required for each location (y,x) where 3146 !-- Note that a soil_type is required for each location (y,x) where 3135 3147 !-- either vegetation_type or pavement_type is a nonÂmissing value. 3136 3148 IF ( ( vegetation_type_f%var(j,i) /= vegetation_type_f%fill .OR. & … … 3154 3166 ENDIF 3155 3167 ! 3156 !-- Check for consistency of surface fraction. If more than one type 3157 !-- is set, surface fraction need to be given and the sum must not 3168 !-- Check for consistency of surface fraction. If more than one type 3169 !-- is set, surface fraction need to be given and the sum must not 3158 3170 !-- be larger than 1. 3159 3171 n_surf = 0 … … 3164 3176 IF ( pavement_type_f%var(j,i) /= pavement_type_f%fill ) & 3165 3177 n_surf = n_surf + 1 3166 3178 3167 3179 IF ( n_surf > 1 ) THEN 3168 3180 IF ( ANY ( surface_fraction_f%frac(:,j,i) == & … … 3181 3193 ENDIF 3182 3194 ! 3183 !-- Check for further mismatches, e.g. vegetation_type is set but 3184 !-- surface vegetation fraction is zero. 3195 !-- Check for further mismatches, e.g. vegetation_type is set but 3196 !-- surface vegetation fraction is zero. 3185 3197 IF ( ( vegetation_type_f%var(j,i) /= vegetation_type_f%fill .AND.& 3186 3198 ( surface_fraction_f%frac(ind_veg_wall,j,i) == 0.0_wp .OR. & … … 3197 3209 surface_fraction_f%frac(ind_wat_win,j,i) == & 3198 3210 surface_fraction_f%fill ) & 3199 ) ) THEN 3211 ) ) THEN 3200 3212 WRITE( message_string, * ) 'Mismatch in setting of ' // & 3201 3213 'surface_fraction. Vegetation-, pavement-, or '// & … … 3206 3218 ENDIF 3207 3219 ! 3208 !-- Check for further mismatches, e.g. vegetation_type is not set 3209 !-- surface vegetation fraction is non-zero. 3220 !-- Check for further mismatches, e.g. vegetation_type is not set 3221 !-- surface vegetation fraction is non-zero. 3210 3222 IF ( ( vegetation_type_f%var(j,i) == vegetation_type_f%fill .AND.& 3211 3223 ( surface_fraction_f%frac(ind_veg_wall,j,i) /= 0.0_wp .AND. & … … 3222 3234 surface_fraction_f%frac(ind_wat_win,j,i) /= & 3223 3235 surface_fraction_f%fill ) & 3224 ) ) THEN 3236 ) ) THEN 3225 3237 WRITE( message_string, * ) 'Mismatch in setting of ' // & 3226 3238 'surface_fraction. Vegetation-, pavement-, or '// & … … 3232 3244 ENDIF 3233 3245 ! 3234 !-- Check vegetation_pars. If vegetation_type is 0, all parameters 3235 !-- need to be set, otherwise, single parameters set by 3246 !-- Check vegetation_pars. If vegetation_type is 0, all parameters 3247 !-- need to be set, otherwise, single parameters set by 3236 3248 !-- vegetation_type can be overwritten. 3237 3249 IF ( vegetation_type_f%from_file ) THEN … … 3240 3252 vegetation_pars_f%fill ) ) THEN 3241 3253 message_string = 'If vegetation_type(y,x) = 0, all ' // & 3242 'parameters of vegetation_pars at '// & 3243 'this location must be set.' 3254 'parameters of vegetation_pars at '// & 3255 'this location must be set.' 3244 3256 CALL message( 'netcdf_data_input_mod', 'NDI031', & 3245 3257 2, 2, 0, 6, 0 ) … … 3248 3260 ENDIF 3249 3261 ! 3250 !-- Check root distribution. If vegetation_type is 0, all levels must 3262 !-- Check root distribution. If vegetation_type is 0, all levels must 3251 3263 !-- be set. 3252 3264 IF ( vegetation_type_f%from_file ) THEN … … 3255 3267 root_area_density_lsm_f%fill ) ) THEN 3256 3268 message_string = 'If vegetation_type(y,x) = 0, all ' // & 3257 'levels of root_area_dens ity_lsm ' //&3258 'must be set at this location.' 3269 'levels of root_area_dens_s ' // & 3270 'must be set at this location.' 3259 3271 CALL message( 'netcdf_data_input_mod', 'NDI032', & 3260 3272 2, 2, 0, 6, 0 ) … … 3263 3275 ENDIF 3264 3276 ! 3265 !-- Check soil parameters. If soil_type is 0, all parameters 3277 !-- Check soil parameters. If soil_type is 0, all parameters 3266 3278 !-- must be set. 3267 3279 IF ( soil_type_f%from_file ) THEN … … 3279 3291 ENDIF 3280 3292 IF ( .NOT. check_passed ) THEN 3281 message_string = 'If soil_type(y,x) = 0, all levels of ' //& 3282 'soil_pars at this location must be set.' 3293 message_string = 'If soil_type(y,x) = 0, all levels of ' //& 3294 'soil_pars at this location must be set.' 3283 3295 CALL message( 'netcdf_data_input_mod', 'NDI033', & 3284 3296 2, 2, 0, 6, 0 ) … … 3287 3299 3288 3300 ! 3289 !-- Check building parameters. If building_type is 0, all parameters 3301 !-- Check building parameters. If building_type is 0, all parameters 3290 3302 !-- must be set. 3291 3303 IF ( building_type_f%from_file ) THEN … … 3295 3307 message_string = 'If building_type(y,x) = 0, all ' // & 3296 3308 'parameters of building_pars at this '//& 3297 'location must be set.' 3309 'location must be set.' 3298 3310 CALL message( 'netcdf_data_input_mod', 'NDI034', & 3299 3311 2, 2, 0, 6, 0 ) … … 3332 3344 ! 3333 3345 !-- Check if at each location where a building is present also an ID 3334 !-- is set and vice versa. 3346 !-- is set and vice versa. 3335 3347 IF ( buildings_f%from_file ) THEN 3336 3348 IF ( buildings_f%lod == 1 ) THEN … … 3356 3368 ! 3357 3369 !-- Check if at each location where a building ID or a -type is set 3358 !-- also a bulding is defined. 3370 !-- also a bulding is defined. 3359 3371 IF ( buildings_f%from_file ) THEN 3360 3372 IF ( buildings_f%lod == 1 ) THEN … … 3377 3389 ENDIF 3378 3390 ! 3379 !-- Check albedo parameters. If albedo_type is 0, all parameters 3391 !-- Check albedo parameters. If albedo_type is 0, all parameters 3380 3392 !-- must be set. 3381 3393 IF ( albedo_type_f%from_file ) THEN … … 3385 3397 message_string = 'If albedo_type(y,x) = 0, all ' // & 3386 3398 'parameters of albedo_pars at this ' // & 3387 'location must be set.' 3399 'location must be set.' 3388 3400 CALL message( 'netcdf_data_input_mod', 'NDI037', & 3389 3401 2, 2, 0, 6, 0 ) … … 3393 3405 3394 3406 ! 3395 !-- Check pavement parameters. If pavement_type is 0, all parameters 3407 !-- Check pavement parameters. If pavement_type is 0, all parameters 3396 3408 !-- of pavement_pars must be set at this location. 3397 3409 IF ( pavement_type_f%from_file ) THEN … … 3401 3413 message_string = 'If pavement_type(y,x) = 0, all ' // & 3402 3414 'parameters of pavement_pars at this '//& 3403 'location must be set.' 3415 'location must be set.' 3404 3416 CALL message( 'netcdf_data_input_mod', 'NDI038', & 3405 3417 2, 2, 0, 6, 0 ) … … 3408 3420 ENDIF 3409 3421 ! 3410 !-- Check pavement-subsurface parameters. If pavement_type is 0, 3411 !-- all parameters of pavement_subsurface_pars must be set at this 3422 !-- Check pavement-subsurface parameters. If pavement_type is 0, 3423 !-- all parameters of pavement_subsurface_pars must be set at this 3412 3424 !-- location. 3413 3425 IF ( pavement_type_f%from_file ) THEN … … 3418 3430 'parameters of ' // & 3419 3431 'pavement_subsurface_pars at this '// & 3420 'location must be set.' 3432 'location must be set.' 3421 3433 CALL message( 'netcdf_data_input_mod', 'NDI039', & 3422 3434 2, 2, 0, 6, 0 ) … … 3426 3438 3427 3439 ! 3428 !-- Check water parameters. If water_type is 0, all parameters 3440 !-- Check water parameters. If water_type is 0, all parameters 3429 3441 !-- must be set at this location. 3430 3442 IF ( water_type_f%from_file ) THEN … … 3434 3446 message_string = 'If water_type(y,x) = 0, all ' // & 3435 3447 'parameters of water_pars at this ' // & 3436 'location must be set.' 3448 'location must be set.' 3437 3449 CALL message( 'netcdf_data_input_mod', 'NDI040', & 3438 3450 2, 2, 0, 6, 0 ) … … 3461 3473 INTEGER(iwp) :: kl !< lower index bound along z-direction 3462 3474 INTEGER(iwp) :: ku !< upper index bound along z-direction 3463 INTEGER(iwp) :: nz_file !< number of vertical levels on file 3464 3465 3466 REAL(wp), DIMENSION(:) :: z_grid !< grid levels on numeric grid 3467 REAL(wp), DIMENSION(:) :: z_file !< grid levels on file grid 3475 INTEGER(iwp) :: nz_file !< number of vertical levels on file 3476 3477 3478 REAL(wp), DIMENSION(:) :: z_grid !< grid levels on numeric grid 3479 REAL(wp), DIMENSION(:) :: z_file !< grid levels on file grid 3468 3480 REAL(wp), DIMENSION(:), INTENT(INOUT) :: var !< treated variable 3469 3481 REAL(wp), DIMENSION(:), ALLOCATABLE :: var_tmp !< temporary variable … … 3483 3495 ( var(kk+1) - var(kk) ) / & 3484 3496 ( z_file(kk+1) - z_file(kk) ) * & 3485 ( z_grid(k) - z_file(kk) ) 3497 ( z_grid(k) - z_file(kk) ) 3486 3498 3487 3499 ELSEIF ( z_file(kk) - z_grid(k) > 0.0_wp ) THEN … … 3489 3501 ( var(kk) - var(kk-1) ) / & 3490 3502 ( z_file(kk) - z_file(kk-1) ) * & 3491 ( z_grid(k) - z_file(kk-1) ) 3503 ( z_grid(k) - z_file(kk-1) ) 3492 3504 ENDIF 3493 3505 ! 3494 3506 !-- Extrapolate 3495 3507 ELSE 3496 3508 3497 3509 var_tmp(k) = var(ku) + ( var(ku) - var(ku-1) ) / & 3498 3510 ( z_file(ku) - z_file(ku-1) ) * & 3499 ( z_grid(k) - z_file(ku) ) 3500 3511 ( z_grid(k) - z_file(ku) ) 3512 3501 3513 ENDIF 3502 3514 … … 3519 3531 SUBROUTINE netcdf_data_input_interpolate_1d_soil( var, var_file, & 3520 3532 z_grid, z_file, & 3521 nzb_var, nzt_var, & 3533 nzb_var, nzt_var, & 3522 3534 nzb_file, nzt_file ) 3523 3535 … … 3529 3541 INTEGER(iwp) :: kk !< running index z-direction stretched model grid 3530 3542 INTEGER(iwp) :: ku !< upper index bound along z-direction for varialbe from file 3531 INTEGER(iwp) :: nzb_var !< lower bound of final array 3532 INTEGER(iwp) :: nzt_var !< upper bound of final array 3533 INTEGER(iwp) :: nzb_file !< lower bound of file array 3534 INTEGER(iwp) :: nzt_file !< upper bound of file array 3543 INTEGER(iwp) :: nzb_var !< lower bound of final array 3544 INTEGER(iwp) :: nzt_var !< upper bound of final array 3545 INTEGER(iwp) :: nzb_file !< lower bound of file array 3546 INTEGER(iwp) :: nzt_file !< upper bound of file array 3535 3547 3536 3548 ! LOGICAL, OPTIONAL :: depth !< flag indicating reverse z-axis, i.e. depth instead of height, e.g. in case of ocean or soil 3537 3549 3538 REAL(wp), DIMENSION(nzb_var:nzt_var) :: z_grid !< grid levels on numeric grid 3539 REAL(wp), DIMENSION(nzb_file:nzt_file) :: z_file !< grid levels on file grid 3550 REAL(wp), DIMENSION(nzb_var:nzt_var) :: z_grid !< grid levels on numeric grid 3551 REAL(wp), DIMENSION(nzb_file:nzt_file) :: z_file !< grid levels on file grid 3540 3552 REAL(wp), DIMENSION(nzb_var:nzt_var) :: var !< treated variable 3541 3553 REAL(wp), DIMENSION(nzb_file:nzt_file) :: var_file !< temporary variable … … 3548 3560 kk = MINLOC( ABS( z_file - z_grid(k) ), DIM = 1 ) 3549 3561 ! 3550 !-- If closest index on Inifor grid is smaller than top index, 3562 !-- If closest index on Inifor grid is smaller than top index, 3551 3563 !-- interpolate the data 3552 3564 IF ( kk < nzt_file ) THEN … … 3554 3566 var(k) = var_file(kk) + ( var_file(kk+1) - var_file(kk) ) / & 3555 3567 ( z_file(kk+1) - z_file(kk) ) * & 3556 ( z_grid(k) - z_file(kk) ) 3568 ( z_grid(k) - z_file(kk) ) 3557 3569 3558 3570 ELSEIF ( z_file(kk) - z_grid(k) > 0.0_wp ) THEN 3559 3571 var(k) = var_file(kk-1) + ( var_file(kk) - var_file(kk-1) ) / & 3560 3572 ( z_file(kk) - z_file(kk-1) ) * & 3561 ( z_grid(k) - z_file(kk-1) ) 3573 ( z_grid(k) - z_file(kk-1) ) 3562 3574 ENDIF 3563 3575 ! … … 3566 3578 var(k) = var_file(ku) + ( var_file(ku) - var_file(ku-1) ) / & 3567 3579 ( z_file(ku) - z_file(ku-1) ) * & 3568 ( z_grid(k) - z_file(ku) ) 3580 ( z_grid(k) - z_file(ku) ) 3569 3581 3570 3582 ENDIF … … 3592 3604 INTEGER(iwp) :: kl !< lower index bound along z-direction 3593 3605 INTEGER(iwp) :: ku !< upper index bound along z-direction 3594 INTEGER(iwp) :: nz_file !< number of vertical levels on file 3595 3596 3597 REAL(wp), DIMENSION(:) :: z_grid !< grid levels on numeric grid 3598 REAL(wp), DIMENSION(:) :: z_file !< grid levels on file grid 3606 INTEGER(iwp) :: nz_file !< number of vertical levels on file 3607 3608 3609 REAL(wp), DIMENSION(:) :: z_grid !< grid levels on numeric grid 3610 REAL(wp), DIMENSION(:) :: z_file !< grid levels on file grid 3599 3611 REAL(wp), DIMENSION(:,:), INTENT(INOUT) :: var !< treated variable 3600 3612 REAL(wp), DIMENSION(:), ALLOCATABLE :: var_tmp !< temporary variable … … 3617 3629 ( var(kk+1,i) - var(kk,i) ) / & 3618 3630 ( z_file(kk+1) - z_file(kk) ) * & 3619 ( z_grid(k) - z_file(kk) ) 3631 ( z_grid(k) - z_file(kk) ) 3620 3632 3621 3633 ELSEIF ( z_file(kk) - z_grid(k) > 0.0_wp ) THEN … … 3623 3635 ( var(kk,i) - var(kk-1,i) ) / & 3624 3636 ( z_file(kk) - z_file(kk-1) ) * & 3625 ( z_grid(k) - z_file(kk-1) ) 3637 ( z_grid(k) - z_file(kk-1) ) 3626 3638 ENDIF 3627 3639 ! 3628 3640 !-- Extrapolate 3629 3641 ELSE 3630 3642 3631 3643 var_tmp(k) = var(ku,i) + ( var(ku,i) - var(ku-1,i) ) / & 3632 3644 ( z_file(ku) - z_file(ku-1) ) * & 3633 ( z_grid(k) - z_file(ku) ) 3634 3645 ( z_grid(k) - z_file(ku) ) 3646 3635 3647 ENDIF 3636 3648 … … 3664 3676 INTEGER(iwp) :: kl !< lower index bound along z-direction 3665 3677 INTEGER(iwp) :: ku !< upper index bound along z-direction 3666 INTEGER(iwp) :: nz_file !< number of vertical levels on file 3667 3668 REAL(wp), DIMENSION(:) :: z_grid !< grid levels on numeric grid 3678 INTEGER(iwp) :: nz_file !< number of vertical levels on file 3679 3680 REAL(wp), DIMENSION(:) :: z_grid !< grid levels on numeric grid 3669 3681 REAL(wp), DIMENSION(:) :: z_file !< grid levels on file grid 3670 3682 REAL(wp), DIMENSION(:,:,:), INTENT(INOUT) :: var !< treated variable … … 3684 3696 DO k = kl, ku 3685 3697 3686 kk = MINLOC( ABS( z_file - z_grid(k) ), DIM = 1 ) 3698 kk = MINLOC( ABS( z_file - z_grid(k) ), DIM = 1 ) 3687 3699 3688 3700 IF ( kk < ku ) THEN … … 3691 3703 ( var(kk+1,j,i) - var(kk,j,i) ) / & 3692 3704 ( z_file(kk+1) - z_file(kk) ) * & 3693 ( z_grid(k) - z_file(kk) ) 3705 ( z_grid(k) - z_file(kk) ) 3694 3706 3695 3707 ELSEIF ( z_file(kk) - z_grid(k) > 0.0_wp ) THEN … … 3697 3709 ( var(kk,j,i) - var(kk-1,j,i) ) / & 3698 3710 ( z_file(kk) - z_file(kk-1) ) * & 3699 ( z_grid(k) - z_file(kk-1) ) 3711 ( z_grid(k) - z_file(kk-1) ) 3700 3712 ENDIF 3701 3713 ! … … 3705 3717 ( var(ku,j,i) - var(ku-1,j,i) ) / & 3706 3718 ( z_file(ku) - z_file(ku-1) ) * & 3707 ( z_grid(k) - z_file(ku) ) 3719 ( z_grid(k) - z_file(ku) ) 3708 3720 3709 3721 ENDIF … … 3817 3829 3818 3830 CHARACTER(LEN=*) :: attribute_name !< attribute name 3819 CHARACTER(LEN=*), OPTIONAL :: variable_name !< variable name 3831 CHARACTER(LEN=*), OPTIONAL :: variable_name !< variable name 3820 3832 3821 3833 INTEGER(iwp), INTENT(IN) :: id !< file id … … 3832 3844 CALL handle_error( 'get_attribute_int32 global', 522 ) 3833 3845 ! 3834 !-- Read attributes referring to a single variable. Therefore, first inquire 3846 !-- Read attributes referring to a single variable. Therefore, first inquire 3835 3847 !-- variable id 3836 3848 ELSE … … 3838 3850 CALL handle_error( 'get_attribute_int32', 522 ) 3839 3851 nc_stat = NF90_GET_ATT( id, id_var, TRIM( attribute_name ), value ) 3840 CALL handle_error( 'get_attribute_int32', 522 ) 3852 CALL handle_error( 'get_attribute_int32', 522 ) 3841 3853 ENDIF 3842 3854 #endif … … 3856 3868 3857 3869 CHARACTER(LEN=*) :: attribute_name !< attribute name 3858 CHARACTER(LEN=*), OPTIONAL :: variable_name !< variable name 3870 CHARACTER(LEN=*), OPTIONAL :: variable_name !< variable name 3859 3871 3860 3872 INTEGER(iwp), INTENT(IN) :: id !< file id … … 3871 3883 CALL handle_error( 'get_attribute_int8 global', 523 ) 3872 3884 ! 3873 !-- Read attributes referring to a single variable. Therefore, first inquire 3885 !-- Read attributes referring to a single variable. Therefore, first inquire 3874 3886 !-- variable id 3875 3887 ELSE … … 3877 3889 CALL handle_error( 'get_attribute_int8', 523 ) 3878 3890 nc_stat = NF90_GET_ATT( id, id_var, TRIM( attribute_name ), value ) 3879 CALL handle_error( 'get_attribute_int8', 523 ) 3891 CALL handle_error( 'get_attribute_int8', 523 ) 3880 3892 ENDIF 3881 3893 #endif … … 3895 3907 3896 3908 CHARACTER(LEN=*) :: attribute_name !< attribute name 3897 CHARACTER(LEN=*), OPTIONAL :: variable_name !< variable name 3909 CHARACTER(LEN=*), OPTIONAL :: variable_name !< variable name 3898 3910 3899 3911 INTEGER(iwp), INTENT(IN) :: id !< file id … … 3912 3924 CALL handle_error( 'get_attribute_real global', 524 ) 3913 3925 ! 3914 !-- Read attributes referring to a single variable. Therefore, first inquire 3926 !-- Read attributes referring to a single variable. Therefore, first inquire 3915 3927 !-- variable id 3916 3928 ELSE … … 3918 3930 CALL handle_error( 'get_attribute_real', 524 ) 3919 3931 nc_stat = NF90_GET_ATT( id, id_var, TRIM( attribute_name ), value ) 3920 CALL handle_error( 'get_attribute_real', 524 ) 3932 CALL handle_error( 'get_attribute_real', 524 ) 3921 3933 ENDIF 3922 3934 #endif … … 3938 3950 3939 3951 CHARACTER(LEN=*) :: attribute_name !< attribute name 3940 CHARACTER(LEN=*), OPTIONAL :: variable_name !< variable name 3952 CHARACTER(LEN=*), OPTIONAL :: variable_name !< variable name 3941 3953 CHARACTER(LEN=*), INTENT(INOUT) :: value !< read value 3942 3954 … … 3953 3965 CALL handle_error( 'get_attribute_string global', 525 ) 3954 3966 ! 3955 !-- Read attributes referring to a single variable. Therefore, first inquire 3967 !-- Read attributes referring to a single variable. Therefore, first inquire 3956 3968 !-- variable id 3957 3969 ELSE … … 3960 3972 3961 3973 nc_stat = NF90_GET_ATT( id, id_var, TRIM( attribute_name ), value ) 3962 CALL handle_error( 'get_attribute_string',525 ) 3974 CALL handle_error( 'get_attribute_string',525 ) 3963 3975 3964 3976 ENDIF … … 3980 3992 IMPLICIT NONE 3981 3993 3982 CHARACTER(LEN=*) :: variable_name !< dimension name 3994 CHARACTER(LEN=*) :: variable_name !< dimension name 3983 3995 CHARACTER(LEN=100) :: dum !< dummy variable to receive return character 3984 3996 … … 3994 4006 !-- Inquire dimension length 3995 4007 nc_stat = NF90_INQUIRE_DIMENSION( id, id_dim, dum, LEN = dim_len ) 3996 CALL handle_error( 'get_dimension_length', 526 ) 4008 CALL handle_error( 'get_dimension_length', 526 ) 3997 4009 3998 4010 #endif … … 4002 4014 ! Description: 4003 4015 ! ------------ 4004 !> Reads a 1D integer variable from file. 4016 !> Reads a 1D integer variable from file. 4005 4017 !------------------------------------------------------------------------------! 4006 4018 SUBROUTINE get_variable_1d_int( id, variable_name, var ) … … 4010 4022 IMPLICIT NONE 4011 4023 4012 CHARACTER(LEN=*) :: variable_name !< variable name 4024 CHARACTER(LEN=*) :: variable_name !< variable name 4013 4025 4014 4026 INTEGER(iwp), INTENT(IN) :: id !< file id … … 4025 4037 !-- Inquire dimension length 4026 4038 nc_stat = NF90_GET_VAR( id, id_var, var ) 4027 CALL handle_error( 'get_variable_1d_int', 527 ) 4039 CALL handle_error( 'get_variable_1d_int', 527 ) 4028 4040 4029 4041 #endif … … 4033 4045 ! Description: 4034 4046 ! ------------ 4035 !> Reads a 1D float variable from file. 4047 !> Reads a 1D float variable from file. 4036 4048 !------------------------------------------------------------------------------! 4037 4049 SUBROUTINE get_variable_1d_real( id, variable_name, var ) … … 4041 4053 IMPLICIT NONE 4042 4054 4043 CHARACTER(LEN=*) :: variable_name !< variable name 4055 CHARACTER(LEN=*) :: variable_name !< variable name 4044 4056 4045 4057 INTEGER(iwp), INTENT(IN) :: id !< file id … … 4056 4068 !-- Inquire dimension length 4057 4069 nc_stat = NF90_GET_VAR( id, id_var, var ) 4058 CALL handle_error( 'get_variable_1d_real', 527 ) 4070 CALL handle_error( 'get_variable_1d_real', 527 ) 4059 4071 4060 4072 #endif … … 4065 4077 ! Description: 4066 4078 ! ------------ 4067 !> Reads a time-dependent 1D float variable from file. 4079 !> Reads a time-dependent 1D float variable from file. 4068 4080 !------------------------------------------------------------------------------! 4069 4081 SUBROUTINE get_variable_pr( id, variable_name, t, var ) … … 4074 4086 IMPLICIT NONE 4075 4087 4076 CHARACTER(LEN=*) :: variable_name !< variable name 4088 CHARACTER(LEN=*) :: variable_name !< variable name 4077 4089 4078 4090 INTEGER(iwp), INTENT(IN) :: id !< file id … … 4092 4104 nc_stat = NF90_INQUIRE_DIMENSION( id, id_dim(1), LEN = n_file ) 4093 4105 ! 4094 !-- Read variable. 4106 !-- Read variable. 4095 4107 nc_stat = NF90_GET_VAR( id, id_var, var, & 4096 4108 start = (/ 1, t /), & 4097 4109 count = (/ n_file, 1 /) ) 4098 CALL handle_error( 'get_variable_pr', 527 ) 4110 CALL handle_error( 'get_variable_pr', 527 ) 4099 4111 4100 4112 #endif … … 4105 4117 ! Description: 4106 4118 ! ------------ 4107 !> Reads a 2D REAL variable from a file. Reading is done processor-wise, 4108 !> i.e. each core reads its own domain in slices along x. 4109 !------------------------------------------------------------------------------! 4119 !> Reads a 2D REAL variable from a file. Reading is done processor-wise, 4120 !> i.e. each core reads its own domain in slices along x. 4121 !------------------------------------------------------------------------------! 4110 4122 SUBROUTINE get_variable_2d_real( id, variable_name, i, var ) 4111 4123 … … 4139 4151 ! Description: 4140 4152 ! ------------ 4141 !> Reads a 2D 32-bit INTEGER variable from file. Reading is done processor-wise, 4142 !> i.e. each core reads its own domain in slices along x. 4153 !> Reads a 2D 32-bit INTEGER variable from file. Reading is done processor-wise, 4154 !> i.e. each core reads its own domain in slices along x. 4143 4155 !------------------------------------------------------------------------------! 4144 4156 SUBROUTINE get_variable_2d_int32( id, variable_name, i, var ) … … 4172 4184 ! Description: 4173 4185 ! ------------ 4174 !> Reads a 2D 8-bit INTEGER variable from file. Reading is done processor-wise, 4175 !> i.e. each core reads its own domain in slices along x. 4186 !> Reads a 2D 8-bit INTEGER variable from file. Reading is done processor-wise, 4187 !> i.e. each core reads its own domain in slices along x. 4176 4188 !------------------------------------------------------------------------------! 4177 4189 SUBROUTINE get_variable_2d_int8( id, variable_name, i, var ) … … 4249 4261 ! Description: 4250 4262 ! ------------ 4251 !> Reads a 3D float variable from file. 4263 !> Reads a 3D float variable from file. 4252 4264 !------------------------------------------------------------------------------! 4253 4265 SUBROUTINE get_variable_3d_real( id, variable_name, i, j, var ) … … 4369 4381 ! Description: 4370 4382 ! ------------ 4371 !> Reads a 4D float variable from file. Note, in constrast to 3D versions, 4383 !> Reads a 4D float variable from file. Note, in constrast to 3D versions, 4372 4384 !> dimensions are already inquired and passed so that they are known here. 4373 4385 !------------------------------------------------------------------------------! … … 4411 4423 ! Description: 4412 4424 ! ------------ 4413 !> Reads a 3D float variable at left, right, north, south and top boundaries. 4425 !> Reads a 3D float variable at left, right, north, south and top boundaries. 4414 4426 !------------------------------------------------------------------------------! 4415 4427 SUBROUTINE get_variable_bc( id, variable_name, t_start, & … … 4431 4443 INTEGER(iwp) :: t_start !< start index at time dimension with respect to netcdf convention 4432 4444 4433 REAL(wp), DIMENSION(:), INTENT(INOUT) :: var !< input variable 4445 REAL(wp), DIMENSION(:), INTENT(INOUT) :: var !< input variable 4434 4446 #if defined( __netcdf ) 4435 4447 … … 4440 4452 !-- Get variable 4441 4453 nc_stat = NF90_GET_VAR( id, id_var, var, & 4442 start = (/ i3_s, i2_s, t_start /), & 4443 count = (/ count_3, count_2, 1 /) ) 4454 start = (/ i3_s, i2_s, t_start /), & 4455 count = (/ count_3, count_2, 1 /) ) 4444 4456 4445 4457 CALL handle_error( 'get_variable_bc', 532 ) … … 4452 4464 ! Description: 4453 4465 ! ------------ 4454 !> Inquires the number of variables in a file 4466 !> Inquires the number of variables in a file 4455 4467 !------------------------------------------------------------------------------! 4456 4468 SUBROUTINE inquire_num_variables( id, num_vars ) … … 4475 4487 ! Description: 4476 4488 ! ------------ 4477 !> Inquires the variable names belonging to a file. 4489 !> Inquires the variable names belonging to a file. 4478 4490 !------------------------------------------------------------------------------! 4479 4491 SUBROUTINE inquire_variable_names( id, var_names )
Note: See TracChangeset
for help on using the changeset viewer.