Changeset 4877 for palm/trunk/SOURCE/netcdf_data_input_mod.f90
- Timestamp:
- Feb 17, 2021 4:17:35 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
palm/trunk/SOURCE/netcdf_data_input_mod.f90
r4828 r4877 24 24 ! ----------------- 25 25 ! $Id$ 26 ! Add interface for resize_array and add subroutine to resize 2d-real arrays 27 ! 28 ! 4828 2021-01-05 11:21:41Z Giersch 26 29 ! Check if netCDF file actually exists before opening it for reading. 27 30 ! … … 787 790 END INTERFACE get_attribute 788 791 792 INTERFACE resize_array 793 MODULE PROCEDURE resize_array_2d_int8 794 MODULE PROCEDURE resize_array_2d_int32 795 MODULE PROCEDURE resize_array_2d_real 796 MODULE PROCEDURE resize_array_3d_int8 797 MODULE PROCEDURE resize_array_3d_real 798 MODULE PROCEDURE resize_array_4d_real 799 END INTERFACE resize_array 800 789 801 ! 790 802 !-- Public data structures … … 867 879 netcdf_data_input_surface_data, & 868 880 netcdf_data_input_topo, & 869 open_read_file 881 open_read_file, & 882 resize_array 870 883 871 884 … … 3427 3440 3428 3441 END SUBROUTINE resize_array_2d_int32 3442 3443 !--------------------------------------------------------------------------------------------------! 3444 ! Description: 3445 ! ------------ 3446 !> Resize 2D float array: (nys:nyn,nxl:nxr) -> (nysg:nyng,nxlg:nxrg) 3447 !--------------------------------------------------------------------------------------------------! 3448 SUBROUTINE resize_array_2d_real( var, js, je, is, ie ) 3449 3450 IMPLICIT NONE 3451 3452 INTEGER(iwp) :: ie !< upper index bound along x direction 3453 INTEGER(iwp) :: is !< lower index bound along x direction 3454 INTEGER(iwp) :: je !< upper index bound along y direction 3455 INTEGER(iwp) :: js !< lower index bound along y direction 3456 3457 REAL(wp), DIMENSION(:,:), ALLOCATABLE :: var !< treated variable 3458 REAL(wp), DIMENSION(:,:), ALLOCATABLE :: var_tmp !< temporary copy 3459 ! 3460 !-- Allocate temporary variable 3461 ALLOCATE( var_tmp(js-nbgp:je+nbgp,is-nbgp:ie+nbgp) ) 3462 ! 3463 !-- Temporary copy of the variable 3464 var_tmp(js:je,is:ie) = var(js:je,is:ie) 3465 ! 3466 !-- Resize the array 3467 DEALLOCATE( var ) 3468 ALLOCATE( var(js-nbgp:je+nbgp,is-nbgp:ie+nbgp) ) 3469 ! 3470 !-- Transfer temporary copy back to original array 3471 var(js:je,is:ie) = var_tmp(js:je,is:ie) 3472 3473 END SUBROUTINE resize_array_2d_real 3429 3474 3430 3475
Note: See TracChangeset
for help on using the changeset viewer.