- Timestamp:
- May 13, 2018 7:05:43 AM (6 years ago)
- Location:
- palm/trunk/SOURCE
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
palm/trunk/SOURCE/message.f90
r2961 r3019 25 25 ! ----------------- 26 26 ! $Id$ 27 ! Temporaraly deactivate MPI_BARRIER as long as nested systems freeze due to 28 ! asynchronous calls of location_message. 29 ! 30 ! 2961 2018-04-12 10:13:48Z suehring 27 31 ! Synchronize location message between parent and child. Message will be not 28 32 ! flushed before all models finished their respective task. … … 267 271 268 272 #if defined( __parallel ) 269 IF ( nested_run ) CALL MPI_BARRIER( MPI_COMM_WORLD, ierr )273 ! IF ( nested_run ) CALL MPI_BARRIER( MPI_COMM_WORLD, ierr ) 270 274 #endif 271 275 ! -
palm/trunk/SOURCE/netcdf_data_input_mod.f90
r2963 r3019 25 25 ! ----------------- 26 26 ! $Id$ 27 ! Improved reading speed of large NetCDF files 28 ! 29 ! 2963 2018-04-12 14:47:44Z suehring 27 30 ! - Revise checks for static input variables. 28 31 ! - Introduce index for vegetation/wall, pavement/green-wall and water/window … … 415 418 LOGICAL :: input_pids_dynamic = .FALSE. !< Flag indicating whether Palm-input-data-standard file containing dynamic information exists 416 419 420 LOGICAL :: collective_read = .FALSE. !< Enable NetCDF collective read 421 417 422 SAVE 418 423 … … 466 471 MODULE PROCEDURE get_variable_3d_int8 467 472 MODULE PROCEDURE get_variable_3d_real 473 MODULE PROCEDURE get_variable_3d_real_v 468 474 MODULE PROCEDURE get_variable_4d_real 469 475 END INTERFACE get_variable … … 666 672 nys:nyn,nxl:nxr) ) 667 673 668 DO i = nxl, nxr 669 DO j = nys, nyn 670 CALL get_variable( id_surf, 'leaf_area_density', & 671 i, j, & 672 leaf_area_density_f%var(:,j,i) ) 673 ENDDO 674 ENDDO 674 CALL get_variable( id_surf, 'leaf_area_density', & 675 nxl, nxr, nys, nyn, & 676 leaf_area_density_f%var(:,nys:nyn, nxl:nxr) ) 677 675 678 ELSE 676 679 leaf_area_density_f%from_file = .FALSE. … … 695 698 nys:nyn,nxl:nxr) ) 696 699 697 DO i = nxl, nxr 698 DO j = nys, nyn 699 CALL get_variable( id_surf, 'basal_area_density', & 700 i, j, & 701 basal_area_density_f%var(:,j,i) ) 702 ENDDO 703 ENDDO 700 CALL get_variable( id_surf, 'basal_area_density', & 701 nxl, nxr, nys, nyn, & 702 basal_area_density_f%var(:,nys:nyn, nxl:nxr) ) 704 703 ELSE 705 704 basal_area_density_f%from_file = .FALSE. … … 724 723 nys:nyn,nxl:nxr) ) 725 724 726 DO i = nxl, nxr 727 DO j = nys, nyn 728 CALL get_variable( id_surf, 'root_area_density_lad', & 729 i, j, & 730 root_area_density_lad_f%var(:,j,i) ) 731 ENDDO 732 ENDDO 725 CALL get_variable( id_surf, 'root_area_density_lad', & 726 nxl, nxr, nys, nyn, & 727 root_area_density_lad_f%var(:,nys:nyn, nxl:nxr) ) 733 728 ELSE 734 729 root_area_density_lad_f%from_file = .FALSE. … … 890 885 ! 891 886 !-- Read surface fractions 892 DO i = nxl, nxr 893 DO j = nys, nyn 894 CALL get_variable( id_surf, 'surface_fraction', i, j, & 895 surface_fraction_f%frac(:,j,i) ) 896 ENDDO 897 ENDDO 887 CALL get_variable( id_surf, 'surface_fraction', & 888 nxl, nxr, nys, nyn, & 889 surface_fraction_f%frac(:,nys:nyn, nxl:nxr)) 898 890 ELSE 899 891 surface_fraction_f%from_file = .FALSE. … … 922 914 ! 923 915 !-- Read building_pars 924 DO i = nxl, nxr 925 DO j = nys, nyn 926 CALL get_variable( id_surf, 'building_pars', i, j, & 927 building_pars_f%pars_xy(:,j,i) ) 928 ENDDO 929 ENDDO 916 CALL get_variable( id_surf, 'building_pars', & 917 nxl, nxr, nys, nyn, & 918 building_pars_f%pars_xy(:,nys:nyn, nxl:nxr) ) 930 919 ELSE 931 920 building_pars_f%from_file = .FALSE. … … 1075 1064 vegetation_pars_f%pars ) 1076 1065 1077 DO i = nxl, nxr 1078 DO j = nys, nyn 1079 CALL get_variable( id_surf, 'vegetation_pars', i, j, & 1080 vegetation_pars_f%pars_xy(:,j,i) ) 1081 ENDDO 1082 ENDDO 1066 CALL get_variable( id_surf, 'vegetation_pars', & 1067 nxl, nxr, nys, nyn, & 1068 vegetation_pars_f%pars_xy(:,nys:nyn,nxl:nxr ) ) 1083 1069 ELSE 1084 1070 vegetation_pars_f%from_file = .FALSE. … … 3796 3782 LOGICAL :: file_open = .FALSE. 3797 3783 3784 #if defined( __netcdf4_parallel ) 3785 ! if __netcdf4_parallel is defined, parrallel NetCDF will be used unconditionally 3786 nc_stat = NF90_OPEN( filename, IOR( NF90_WRITE, NF90_MPIIO ), id, & 3787 COMM = comm2d, INFO = MPI_INFO_NULL ) 3788 IF(nc_stat /= NF90_NOERR ) THEN !possible NetCDF 3 file 3789 nc_stat = NF90_OPEN( filename, NF90_NOWRITE, id ) 3790 collective_read = .FALSE. 3791 write(9,*) 'open ',TRIM(filename),' as serial NetCDF file on every PE' 3792 ELSE 3793 collective_read = .TRUE. 3794 write(9,*) 'open ',TRIM(filename),' using parallel NetCDF' 3795 END IF 3796 #else 3797 ! All MPI processes open und read 3798 3798 nc_stat = NF90_OPEN( filename, NF90_NOWRITE, id ) 3799 #endif 3799 3800 3800 3801 CALL handle_error( 'open_read_file', 536 ) … … 4285 4286 4286 4287 CALL handle_error( 'get_variable_3d_real', 532 ) 4288 4287 4289 #endif 4288 4290 END SUBROUTINE get_variable_3d_real 4291 4292 !------------------------------------------------------------------------------! 4293 ! Description: 4294 ! ------------ 4295 !> Reads a 3D float array from file. 4296 !------------------------------------------------------------------------------! 4297 SUBROUTINE get_variable_3d_real_v( id, variable_name, is, ie, js, je, var ) 4298 4299 USE indices 4300 USE pegrid 4301 4302 IMPLICIT NONE 4303 4304 CHARACTER(LEN=*) :: variable_name !< variable name 4305 4306 INTEGER(iwp), INTENT(IN) :: is,ie !< index range along x direction 4307 INTEGER(iwp), INTENT(IN) :: id !< file id 4308 INTEGER(iwp) :: id_var !< variable id 4309 INTEGER(iwp), INTENT(IN) :: js,je !< index range along y direction 4310 INTEGER(iwp) :: n3 !< number of data-points along 3rd dimension 4311 4312 INTEGER(iwp) :: i,j,k 4313 INTEGER(iwp), DIMENSION(3) :: id_dim 4314 4315 REAL(wp), DIMENSION(:,:,:), INTENT(INOUT) :: var !< variable to be read 4316 #if defined( __netcdf ) 4317 ! 4318 !-- Inside the ...static NetCDF files, the array is stored as float. 4319 !-- Therefore single precision is sufficiant for the temporary array 4320 4321 REAL(sp), DIMENSION(:,:,:), ALLOCATABLE :: tmp_var !< temporary array to read NetCDF data in i,j,k direction 4322 4323 !kk Please check, if it is time consuming to do the inquire every time 4324 ! 4325 !-- Inquire variable id 4326 nc_stat = NF90_INQ_VARID( id, TRIM( variable_name ), id_var ) 4327 ! 4328 !-- Get length of first dimension, required for the count parameter. 4329 !-- Therefore, first inquired dimension ids 4330 nc_stat = NF90_INQUIRE_VARIABLE( id, id_var, DIMIDS = id_dim ) 4331 nc_stat = NF90_INQUIRE_DIMENSION( id, id_dim(3), LEN = n3 ) 4332 4333 IF(collective_read) THEN 4334 nc_stat = NF90_VAR_PAR_ACCESS (id, id_var, NF90_COLLECTIVE) 4335 ENDIF 4336 4337 ! 4338 !-- Allocate temporary array ro read NetCDF data in i,j,k direction 4339 4340 ALLOCATE(tmp_var(is:ie,js:je,n3)) 4341 ! 4342 !-- Get variable 4343 !-- Read complete local 3-D array in oone call 4344 4345 nc_stat = NF90_GET_VAR( id, id_var, tmp_var, & 4346 start = (/ is+1, js+1, 1 /), & 4347 count = (/ ie-is+1, je-js+1, n3 /) ) 4348 4349 CALL handle_error( 'get_variable_3d_real', 532 ) 4350 4351 ! 4352 !-- Resort data in k,j,i direction 4353 4354 DO i=is,ie 4355 DO j=js,je 4356 DO K=1,n3 4357 var (k,j-js+1,i-is+1) = tmp_var(i,j,k) 4358 END DO 4359 END DO 4360 END DO 4361 4362 DEALLOCATE(tmp_var) 4363 4364 #endif 4365 END SUBROUTINE get_variable_3d_real_v 4289 4366 4290 4367
Note: See TracChangeset
for help on using the changeset viewer.