Ignore:
Timestamp:
Jul 10, 2020 10:13:23 AM (9 months ago)
Author:
suehring
Message:

Revise and bugfix surface-element mapping and 3D soil array in mpi-io restart branch

File:
1 edited

Legend:

Unmodified
Added
Removed
  • palm/trunk/SOURCE/restart_data_mpi_io_mod.f90

    r4591 r4598  
    2525! -----------------
    2626! $Id$
     27! Bugfix in treatment of 3D soil arrays
     28!
     29! 4591 2020-07-06 15:56:08Z raasch
    2730! File re-formatted to follow the PALM coding standard
    2831!
     
    823826#endif
    824827
    825        IF ( include_total_domain_boundaries)  THEN
     828       IF ( include_total_domain_boundaries )  THEN
    826829          DO  i = lb%nxl, lb%nxr
    827830             data(lb%nys-nbgp:lb%nyn-nbgp,i-nbgp) = array_2d(i,lb%nys:lb%nyn)
     
    980983       CALL posix_read(fh, array_3d, SIZE( array_3d ) )
    981984#endif
    982        IF ( include_total_domain_boundaries)  THEN
    983           DO  i = lb%nxl, lb%nxr
    984              data(:,lb%nys-nbgp:lb%nyn-nbgp,i-nbgp) = array_3d(:,i,lb%nys:lb%nyn)
    985           ENDDO
    986        ELSE
    987           DO  i = nxl, nxr
    988              data(:,nys:nyn,i) = array_3d(:,i,nys:nyn)
    989           ENDDO
    990        ENDIF
    991 
    992        CALL exchange_horiz( data, nbgp )
    993 
    994     ELSE
    995 
    996        message_string = '3d-REAL array "' // TRIM( name ) // '" not found in restart file'
    997        CALL message( 'rrd_mpi_io_real_3d', 'PA0722', 3, 2, 0, 6, 0 )
    998 
    999     ENDIF
    1000 
    1001  END SUBROUTINE rrd_mpi_io_real_3d
    1002 
    1003 
    1004 
    1005 !--------------------------------------------------------------------------------------------------!
    1006 ! Description:
    1007 ! ------------
    1008 !> Read 3d-REAL soil array with MPI-IO
    1009 !> nzb_soil, nzt_soil are located in the module land_surface_model_mod. Since Fortran does not allow
    1010 !> cross referencing of module variables, it is required to pass these variables as arguments.
    1011 !--------------------------------------------------------------------------------------------------!
    1012  SUBROUTINE rrd_mpi_io_real_3d_soil( name, data, nzb_soil, nzt_soil )
    1013 
    1014     IMPLICIT NONE
    1015 
    1016     CHARACTER(LEN=*), INTENT(IN)       ::  name      !<
    1017 
    1018     INTEGER(iwp)                       ::  i         !<
    1019     INTEGER, INTENT(IN)                ::  nzb_soil  !<
    1020     INTEGER, INTENT(IN)                ::  nzt_soil  !<
    1021 
    1022 #if defined( __parallel )
    1023     INTEGER, DIMENSION(rd_status_size) ::  status    !<
    1024 #endif
    1025 
    1026     LOGICAL                            ::  found     !<
    1027 
    1028     REAL(wp), INTENT(INOUT), DIMENSION(nzb_soil:nzt_soil,nysg:nyng,nxlg:nxrg) ::  data  !<
    1029 
    1030 
    1031     found = .FALSE.
    1032 
    1033     DO  i = 1, tgh%nr_arrays
    1034        IF ( TRIM(array_names(i)) == TRIM( name ) )  THEN
    1035           array_position = array_offset(i)
    1036           found = .TRUE.
    1037           EXIT
    1038        ENDIF
    1039     ENDDO
    1040 
    1041     IF ( found )  THEN
    1042 #if defined( __parallel )
    1043        CALL rd_mpi_io_create_filetypes_3dsoil( nzb_soil, nzt_soil )
    1044        CALL sm_io%sm_node_barrier()  ! Has no effect if I/O on limited number of cores is inactive
    1045        IF ( sm_io%iam_io_pe )  THEN
    1046           CALL MPI_FILE_SET_VIEW( fh, array_position, MPI_REAL, ft_3dsoil, 'native',               &
    1047                                   MPI_INFO_NULL, ierr )
    1048           CALL MPI_FILE_READ_ALL( fh, array_3d_soil, SIZE( array_3d_soil ), MPI_REAL, status, ierr )
    1049           CALL MPI_TYPE_FREE( ft_3dsoil, ierr )
    1050        ENDIF
    1051        CALL sm_io%sm_node_barrier()
    1052 #else
    1053        CALL posix_lseek( fh, array_position )
    1054        CALL posix_read( fh, array_3d_soil, SIZE( array_3d_soil ) )
    1055 #endif
    1056985       IF ( include_total_domain_boundaries )  THEN
    1057986          DO  i = lb%nxl, lb%nxr
     
    1064993       ENDIF
    1065994
     995       CALL exchange_horiz( data, nbgp )
     996
     997    ELSE
     998
     999       message_string = '3d-REAL array "' // TRIM( name ) // '" not found in restart file'
     1000       CALL message( 'rrd_mpi_io_real_3d', 'PA0722', 3, 2, 0, 6, 0 )
     1001
     1002    ENDIF
     1003
     1004 END SUBROUTINE rrd_mpi_io_real_3d
     1005
     1006
     1007
     1008!--------------------------------------------------------------------------------------------------!
     1009! Description:
     1010! ------------
     1011!> Read 3d-REAL soil array with MPI-IO
     1012!> nzb_soil, nzt_soil are located in the module land_surface_model_mod. Since Fortran does not allow
     1013!> cross referencing of module variables, it is required to pass these variables as arguments.
     1014!--------------------------------------------------------------------------------------------------!
     1015 SUBROUTINE rrd_mpi_io_real_3d_soil( name, data, nzb_soil, nzt_soil )
     1016
     1017    IMPLICIT NONE
     1018
     1019    CHARACTER(LEN=*), INTENT(IN)       ::  name      !<
     1020
     1021    INTEGER(iwp)                       ::  i         !<
     1022    INTEGER, INTENT(IN)                ::  nzb_soil  !<
     1023    INTEGER, INTENT(IN)                ::  nzt_soil  !<
     1024
     1025#if defined( __parallel )
     1026    INTEGER, DIMENSION(rd_status_size) ::  status    !<
     1027#endif
     1028
     1029    LOGICAL                            ::  found     !<
     1030
     1031    REAL(wp), INTENT(INOUT), DIMENSION(nzb_soil:nzt_soil,nysg:nyng,nxlg:nxrg) ::  data  !<
     1032
     1033
     1034    found = .FALSE.
     1035
     1036    DO  i = 1, tgh%nr_arrays
     1037       IF ( TRIM(array_names(i)) == TRIM( name ) )  THEN
     1038          array_position = array_offset(i)
     1039          found = .TRUE.
     1040          EXIT
     1041       ENDIF
     1042    ENDDO
     1043
     1044    IF ( found )  THEN
     1045#if defined( __parallel )
     1046       CALL rd_mpi_io_create_filetypes_3dsoil( nzb_soil, nzt_soil )
     1047       CALL sm_io%sm_node_barrier()  ! Has no effect if I/O on limited number of cores is inactive
     1048       IF ( sm_io%iam_io_pe )  THEN
     1049          CALL MPI_FILE_SET_VIEW( fh, array_position, MPI_REAL, ft_3dsoil, 'native',               &
     1050                                  MPI_INFO_NULL, ierr )
     1051          CALL MPI_FILE_READ_ALL( fh, array_3d_soil, SIZE( array_3d_soil ), MPI_REAL, status, ierr )
     1052          CALL MPI_TYPE_FREE( ft_3dsoil, ierr )
     1053       ENDIF
     1054       CALL sm_io%sm_node_barrier()
     1055#else
     1056       CALL posix_lseek( fh, array_position )
     1057       CALL posix_read( fh, array_3d_soil, SIZE( array_3d_soil ) )
     1058#endif
     1059       IF ( include_total_domain_boundaries )  THEN
     1060          DO  i = lb%nxl, lb%nxr
     1061             data(:,lb%nys-nbgp:lb%nyn-nbgp,i-nbgp) = array_3d_soil(:,i,lb%nys:lb%nyn)
     1062          ENDDO
     1063       ELSE
     1064          DO  i = nxl, nxr
     1065             data(:,nys:nyn,i) = array_3d_soil(:,i,nys:nyn)
     1066          ENDDO
     1067       ENDIF
     1068
    10661069    ELSE
    10671070
     
    14321435#endif
    14331436
    1434     IF ( include_total_domain_boundaries)  THEN
     1437    IF ( include_total_domain_boundaries )  THEN
    14351438!
    14361439!--    Prepare output of 3d-REAL-array with ghost layers. In the virtual PE grid, the first
Note: See TracChangeset for help on using the changeset viewer.