Skip to content

Commit

Permalink
Merge pull request #460 from jedwards4b/fix_mediator_restart
Browse files Browse the repository at this point in the history
avoid integer overflow by skipping mediator in restart loop
  • Loading branch information
jedwards4b committed May 22, 2024
2 parents 95d6f69 + 23a52b2 commit 6384ff4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
6 changes: 4 additions & 2 deletions mediator/med.F90
Original file line number Diff line number Diff line change
Expand Up @@ -2122,7 +2122,7 @@ subroutine DataInitialize(gcomp, rc)
do n1 = 1,ncomps
if (maintask) then
write(logunit,*)
write(logunit,'(a)') trim(subname)//" "//trim(compname(n1))
write(logunit,'(a,2L2)') trim(subname)//" "//trim(compname(n1)), is_local%wrap%comp_present(n1), ESMF_StateIsCreated(is_local%wrap%NStateImp(n1),rc=rc)
end if
if (is_local%wrap%comp_present(n1) .and. ESMF_StateIsCreated(is_local%wrap%NStateImp(n1),rc=rc)) then
call State_GetScalar(scalar_value=real_nx, &
Expand Down Expand Up @@ -2150,12 +2150,14 @@ subroutine DataInitialize(gcomp, rc)
end if
is_local%wrap%nx(n1) = nint(real_nx)
is_local%wrap%ny(n1) = nint(real_ny)
endif
if (is_local%wrap%comp_present(n1)) then
write(msgString,'(3i8)') is_local%wrap%nx(n1), is_local%wrap%ny(n1), is_local%wrap%ntile(n1)
if (maintask) then
write(logunit,'(a)') 'global nx,ny,ntile sizes for '//trim(compname(n1))//":"//trim(msgString)
end if
call ESMF_LogWrite(trim(subname)//":"//trim(compname(n1))//":"//trim(msgString), ESMF_LOGMSG_INFO)
end if
endif
end do
if (maintask) write(logunit,*)

Expand Down
7 changes: 4 additions & 3 deletions mediator/med_phases_restart_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -342,13 +342,14 @@ subroutine med_phases_restart_write(gcomp, rc)
call med_io_write(io_file, next_tod , 'curr_tod' , whead(m), wdata(m), rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return

do n = 1,ncomps
do n = 2,ncomps
if (is_local%wrap%comp_present(n)) then
nx = is_local%wrap%nx(n)
ny = is_local%wrap%ny(n)
if (is_local%wrap%ntile(n) > 0) then
nx = is_local%wrap%ntile(n)*is_local%wrap%ny(n)*is_local%wrap%nx(n)
ny = 1
else
nx = is_local%wrap%nx(n)
ny = is_local%wrap%ny(n)
end if
! Write import field bundles
if (ESMF_FieldBundleIsCreated(is_local%wrap%FBimp(n,n),rc=rc)) then
Expand Down

0 comments on commit 6384ff4

Please sign in to comment.