From 23a52b29ff0ef49a2081aad6613801fc1b57652e Mon Sep 17 00:00:00 2001 From: Jim Edwards Date: Fri, 17 May 2024 10:31:13 -0600 Subject: [PATCH] avoid integer overflow by skipping mediator in restart loop --- mediator/med.F90 | 6 ++++-- mediator/med_phases_restart_mod.F90 | 7 ++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/mediator/med.F90 b/mediator/med.F90 index dc0f68cf..4fdbb06a 100644 --- a/mediator/med.F90 +++ b/mediator/med.F90 @@ -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, & @@ -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,*) diff --git a/mediator/med_phases_restart_mod.F90 b/mediator/med_phases_restart_mod.F90 index 1bbbb0fb..6bbdb6b7 100644 --- a/mediator/med_phases_restart_mod.F90 +++ b/mediator/med_phases_restart_mod.F90 @@ -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