Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

avoid integer overflow by skipping mediator in restart loop #460

Merged
merged 1 commit into from
May 22, 2024
Merged
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
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
Loading