Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 15 additions & 9 deletions dglc/dglc_datamode_noevolve_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -595,7 +595,7 @@ end subroutine dglc_datamode_noevolve_restart_write

!===============================================================================
subroutine dglc_datamode_noevolve_restart_read(model_meshes, restfilem, rpfile, &
logunit, my_task, main_task, mpicom, &
logunit, my_task, main_task, &
pio_subsystem, io_type, nx_global, ny_global, rc)

! input/output arguments
Expand All @@ -605,7 +605,6 @@ subroutine dglc_datamode_noevolve_restart_read(model_meshes, restfilem, rpfile,
integer , intent(in) :: logunit
integer , intent(in) :: my_task
integer , intent(in) :: main_task
integer , intent(in) :: mpicom
type(iosystem_desc_t) , pointer :: pio_subsystem ! pio info
integer , intent(in) :: io_type ! pio info
integer , intent(in) :: nx_global(:)
Expand All @@ -630,21 +629,24 @@ subroutine dglc_datamode_noevolve_restart_read(model_meshes, restfilem, rpfile,
!-------------------------------------------------------------------------------

rc = ESMF_SUCCESS
! Determine restart file

call ESMF_VMGetCurrent(vm, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return

! Determine restart file
!
! Note that we first determine existence only on the main task, then broadcast this to
! other tasks.
exists = .false.
if (trim(restfilem) == trim(nullstr)) then
exists = .false.
call ESMF_VMGetCurrent(vm, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
if (my_task == main_task) then
write(logunit,'(a)') subname//' restart filename from rpointer '//trim(rpfile)
open(newunit=nu, file=trim(rpfile), form='formatted')
read(nu,'(a)') restfilem
close(nu)
inquire(file=trim(restfilem), exist=exists)
endif
call ESMF_VMBroadCast(vm, restfilem, CL, main_task, rc=rc)
call ESMF_VMBroadCast(vm, restfilem, len(restfilem), main_task, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
else
! use namelist already read
Expand All @@ -655,9 +657,13 @@ subroutine dglc_datamode_noevolve_restart_read(model_meshes, restfilem, rpfile,
endif
tmp = 0
if(exists) tmp=1
call ESMF_VMBroadCast(vm, tmp, 1, main_task, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
exists = (tmp(1) == 1)
if (.not. exists .and. my_task == main_task) then
write(logunit, '(a)') subname//' file not found, skipping '//trim(restfilem)
if (.not. exists) then
if (my_task == main_task) then
write(logunit, '(a)') subname//' file not found, skipping '//trim(restfilem)
end if
return
end if

Expand Down
2 changes: 1 addition & 1 deletion dglc/glc_comp_nuopc.F90
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,7 @@ subroutine dglc_comp_run(gcomp, clock, target_ymd, target_tod, restart_write, va
call shr_get_rpointer_name(gcomp, 'glc', target_ymd, target_tod, rpfile, 'read', rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
call dglc_datamode_noevolve_restart_read(model_meshes, restfilm, rpfile, &
logunit, my_task, main_task, mpicom, &
logunit, my_task, main_task, &
sdat(1)%pio_subsystem, sdat(1)%io_type, nx_global, ny_global, rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
end if
Expand Down
2 changes: 1 addition & 1 deletion dshr/dshr_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,7 @@ subroutine dshr_restart_read(rest_filem, rpfile, &
close(nu)
inquire(file=trim(rest_filem), exist=exists)
endif
call ESMF_VMBroadCast(vm, rest_filem, CL, main_task, rc=rc)
call ESMF_VMBroadCast(vm, rest_filem, len(rest_filem), main_task, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
else
! use namelist already read
Expand Down
Loading