Ignore:
Timestamp:
May 3, 2020 2:29:30 PM (14 months ago)
Author:
raasch
Message:

added restart with MPI-IO for reading local arrays

File:
1 edited

Legend:

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

    r4495 r4517  
    2525! -----------------
    2626! $Id$
     27! added restart with MPI-IO for reading local arrays
     28!
     29! 4495 2020-04-13 20:11:20Z raasch
    2730! restart data handling with MPI-IO added
    2831!
     
    291294
    292295    USE restart_data_mpi_io_mod,                                                                   &
    293         ONLY:  rd_mpi_io_surface_filetypes, wrd_mpi_io, wrd_mpi_io_surface
     296        ONLY:  rd_mpi_io_check_array, rd_mpi_io_surface_filetypes, rrd_mpi_io, rrd_mpi_io_surface, &
     297               wrd_mpi_io, wrd_mpi_io_surface
    294298
    295299    USE statistics,                                                            &
     
    808812
    809813    INTERFACE lsm_rrd_local
    810        MODULE PROCEDURE lsm_rrd_local
     814       MODULE PROCEDURE lsm_rrd_local_ftn
     815       MODULE PROCEDURE lsm_rrd_local_mpi
    811816    END INTERFACE lsm_rrd_local
    812817
     
    66746679       CALL wrd_mpi_io( 'lsm_end_index_h',  surf_lsm_h%end_index )
    66756680       CALL wrd_mpi_io( 'lsm_global_start_index_h', global_start_index )
    6676        CALL wrd_mpi_io_surface ( 't_soil_h', t_soil_h%var_2d )
     6681       CALL wrd_mpi_io_surface( 't_soil_h', t_soil_h%var_2d )
    66776682       CALL wrd_mpi_io_surface( 'm_soil_h',  m_soil_h%var_2d )
    66786683       CALL wrd_mpi_io_surface( 'm_liq_h', m_liq_h%var_1d )
     
    66866691                                             surface_data_to_write, global_start_index )
    66876692
    6688           CALL wrd_mpi_io( 'lsm_start_index_v_' //dum,  surf_lsm_v(l)%start_index )
    6689           CALL wrd_mpi_io( 'lsm_end_index_v_' //dum,  surf_lsm_v(l)%end_index )
    6690           CALL wrd_mpi_io( 'lsm_global_start_index_v_' //dum , global_start_index )
     6693          CALL wrd_mpi_io( 'lsm_start_index_v_' // dum,  surf_lsm_v(l)%start_index )
     6694          CALL wrd_mpi_io( 'lsm_end_index_v_' // dum,  surf_lsm_v(l)%end_index )
     6695          CALL wrd_mpi_io( 'lsm_global_start_index_v_' // dum , global_start_index )
    66916696
    66926697          IF ( .NOT. surface_data_to_write )  CYCLE
     
    67086713! Description:
    67096714! ------------
    6710 !> Soubroutine reads lsm data from restart file(s)
     6715!> Read module-specific local restart data arrays (Fortran binary format).
    67116716!------------------------------------------------------------------------------!
    6712  SUBROUTINE lsm_rrd_local( k, nxlf, nxlc, nxl_on_file, nxrf, nxrc,              &
    6713                           nxr_on_file, nynf, nync, nyn_on_file, nysf, nysc,    &
    6714                           nys_on_file, tmp_2d, found )
     6717 SUBROUTINE lsm_rrd_local_ftn( k, nxlf, nxlc, nxl_on_file, nxrf, nxrc,              &
     6718                               nxr_on_file, nynf, nync, nyn_on_file, nysf, nysc,    &
     6719                               nys_on_file, tmp_2d, found )
    67156720
    67166721
     
    73057310
    73067311
    7307  END SUBROUTINE lsm_rrd_local
     7312 END SUBROUTINE lsm_rrd_local_ftn
     7313
     7314!------------------------------------------------------------------------------!
     7315!
     7316! Description:
     7317! ------------
     7318!> Read module-specific local restart data arrays (MPI-IO).
     7319!------------------------------------------------------------------------------!
     7320 SUBROUTINE lsm_rrd_local_mpi
     7321
     7322    USE control_parameters
     7323
     7324    USE indices
     7325
     7326    USE pegrid
     7327
     7328
     7329    IMPLICIT NONE
     7330
     7331    CHARACTER(LEN=1) ::  dum  !< dummy to create correct string for creating variable string
     7332
     7333    INTEGER(iwp) ::  l   !< running index surface orientation
     7334
     7335    INTEGER(iwp), DIMENSION(nys:nyn,nxl:nxr) ::  end_index
     7336    INTEGER(iwp), DIMENSION(nys:nyn,nxl:nxr) ::  global_start
     7337    INTEGER(iwp), DIMENSION(nys:nyn,nxl:nxr) ::  start_index
     7338
     7339    LOGICAL      :: array_found
     7340    LOGICAL      :: ldum
     7341
     7342
     7343    CALL rd_mpi_io_check_array( 'c_liq_av', found = array_found )
     7344    IF ( array_found )  THEN
     7345       IF ( .NOT. ALLOCATED( c_liq_av ) )  ALLOCATE( c_liq_av(nysg:nyng,nxlg:nxrg) )
     7346       CALL rrd_mpi_io( 'c_liq_av',  c_liq_av )
     7347    ENDIF
     7348
     7349    CALL rd_mpi_io_check_array( 'c_soil_av', found = array_found )
     7350    IF ( array_found )  THEN
     7351       IF ( .NOT. ALLOCATED( c_soil_av ) )  ALLOCATE( c_soil_av(nysg:nyng,nxlg:nxrg) )
     7352       CALL rrd_mpi_io( 'c_soil_av',  c_soil_av )
     7353    ENDIF
     7354
     7355    CALL rd_mpi_io_check_array( 'c_veg_av', found = array_found )
     7356    IF ( array_found )  THEN
     7357       IF ( .NOT. ALLOCATED( c_veg_av ) )  ALLOCATE( c_veg_av(nysg:nyng,nxlg:nxrg) )
     7358       CALL rrd_mpi_io( 'c_veg_av',  c_veg_av )
     7359    ENDIF
     7360
     7361    CALL rd_mpi_io_check_array( 'lai_av', found = array_found )
     7362    IF ( array_found )  THEN
     7363       IF ( .NOT. ALLOCATED( lai_av ) )  ALLOCATE( lai_av(nysg:nyng,nxlg:nxrg) )
     7364       CALL rrd_mpi_io( 'lai_av',  lai_av )
     7365    ENDIF
     7366
     7367    CALL rd_mpi_io_check_array( 'm_liq_av', found = array_found )
     7368    IF ( array_found )  THEN
     7369       IF ( .NOT. ALLOCATED( m_liq_av ) )  ALLOCATE( m_liq_av(nysg:nyng,nxlg:nxrg) )
     7370       CALL rrd_mpi_io( 'm_liq_av',  m_liq_av )
     7371    ENDIF
     7372
     7373    CALL rd_mpi_io_check_array( 'm_soil_av', found = array_found )
     7374    IF ( array_found )  THEN
     7375       IF ( .NOT. ALLOCATED( m_soil_av ) )  ALLOCATE( m_soil_av(nzb_soil:nzt_soil,nysg:nyng,nxlg:nxrg) )
     7376       CALL rrd_mpi_io( 'm_soil_av', m_soil_av, nzb_soil, nzt_soil )
     7377    ENDIF
     7378
     7379    CALL rd_mpi_io_check_array( 'qsws_liq_av', found = array_found )
     7380    IF ( array_found )  THEN
     7381       IF ( .NOT. ALLOCATED( qsws_liq_av ) )  ALLOCATE( qsws_liq_av(nysg:nyng,nxlg:nxrg) )
     7382       CALL rrd_mpi_io( 'qsws_liq_av',  qsws_liq_av )
     7383    ENDIF
     7384
     7385    CALL rd_mpi_io_check_array( 'qsws_soil_av', found = array_found )
     7386    IF ( array_found )  THEN
     7387       IF ( .NOT. ALLOCATED( qsws_soil_av ) )  ALLOCATE( qsws_soil_av(nysg:nyng,nxlg:nxrg) )
     7388       CALL rrd_mpi_io( 'qsws_soil_av',  qsws_soil_av )
     7389    ENDIF
     7390
     7391    CALL rd_mpi_io_check_array( 'qsws_veg_av', found = array_found )
     7392    IF ( array_found )  THEN
     7393       IF ( .NOT. ALLOCATED( qsws_veg_av ) )  ALLOCATE( qsws_veg_av(nysg:nyng,nxlg:nxrg) )
     7394       CALL rrd_mpi_io( 'qsws_veg_av',  qsws_veg_av )
     7395    ENDIF
     7396
     7397    CALL rd_mpi_io_check_array( 't_soil_av', found = array_found )
     7398    IF ( array_found )  THEN
     7399       IF ( .NOT. ALLOCATED( t_soil_av ) )  ALLOCATE( t_soil_av(nzb_soil:nzt_soil,nysg:nyng,nxlg:nxrg) )
     7400       CALL rrd_mpi_io( 't_soil_av', t_soil_av, nzb_soil, nzt_soil )
     7401    ENDIF
     7402
     7403    CALL rrd_mpi_io( 'lsm_start_index_h',  surf_lsm_h%start_index )
     7404    CALL rrd_mpi_io( 'lsm_end_index_h',  surf_lsm_h%end_index )
     7405    CALL rrd_mpi_io( 'lsm_global_start_index_h', global_start )
     7406
     7407    CALL rd_mpi_io_surface_filetypes ( surf_lsm_h%start_index, surf_lsm_h%end_index, ldum,         &
     7408                                       global_start )
     7409
     7410    CALL rrd_mpi_io_surface( 't_soil_h', t_soil_h%var_2d )
     7411    CALL rrd_mpi_io_surface( 'm_soil_h',  m_soil_h%var_2d )
     7412    CALL rrd_mpi_io_surface( 'm_liq_h', m_liq_h%var_1d )
     7413    CALL rrd_mpi_io_surface( 't_surface_h', t_surface_h%var_1d )
     7414
     7415
     7416    DO  l = 0, 3
     7417
     7418       WRITE( dum, '(I1)')  l
     7419
     7420!kk    In case of nothing to do, the settings of start_index and end_index differ
     7421!kk    between writing and reading restart file
     7422!kk
     7423!kk    Has to be discussed with the developpers
     7424
     7425       CALL rrd_mpi_io( 'lsm_start_index_v_' // dum,  start_index )
     7426       CALL rrd_mpi_io( 'lsm_end_index_v_' // dum,  end_index )
     7427       CALL rrd_mpi_io( 'lsm_global_start_index_v_' // dum , global_start )
     7428
     7429       CALL rd_mpi_io_surface_filetypes( start_index, end_index, ldum, global_start )
     7430
     7431       IF ( MAXVAL( end_index ) <= 0 )  CYCLE
     7432
     7433       CALL rrd_mpi_io_surface( 't_soil_v(' // dum // ')', t_soil_v(l)%var_2d )
     7434       CALL rrd_mpi_io_surface( 'm_soil_v(' // dum // ')', m_soil_v(l)%var_2d )
     7435       CALL rrd_mpi_io_surface( 'm_liq_v(' // dum // ')',  m_liq_v(l)%var_1d )
     7436       CALL rrd_mpi_io_surface( 't_surface_v(' // dum // ')',  t_surface_v(l)%var_1d )
     7437
     7438    ENDDO
     7439
     7440 END SUBROUTINE lsm_rrd_local_mpi
    73087441
    73097442!------------------------------------------------------------------------------!
Note: See TracChangeset for help on using the changeset viewer.