From 6b68092cc108e1ab825a259076c535d3d0115594 Mon Sep 17 00:00:00 2001 From: Lauren Chilutti <60401591+laurenchilutti@users.noreply.github.com> Date: Fri, 22 Sep 2023 09:27:15 -0400 Subject: [PATCH] tools/fv_io: add missing else statement and ensures all _is_open variables to .false. when files are closed (#284) --- tools/fv_io.F90 | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tools/fv_io.F90 b/tools/fv_io.F90 index 639799bdc..95bf89ddf 100644 --- a/tools/fv_io.F90 +++ b/tools/fv_io.F90 @@ -729,8 +729,9 @@ subroutine remap_restart(Atm) call read_restart(Atm(1)%Rsf_restart, ignore_checksum=Atm(1)%flagstruct%ignore_rst_cksum) call close_file(Atm(1)%Rsf_restart) Atm(1)%Rsf_restart_is_open = .false. - call mpp_error(NOTE,'==> Warning from remap_restart: Expected file '//trim(fname)//' does not exist') - Atm%flagstruct%srf_init = .false. + else + call mpp_error(NOTE,'==> Warning from remap_restart: Expected file '//trim(fname)//' does not exist') + Atm%flagstruct%srf_init = .false. endif if ( Atm(1)%flagstruct%fv_land ) then @@ -740,6 +741,7 @@ subroutine remap_restart(Atm) if (Atm(1)%Mg_restart_is_open) then call read_data(Atm(1)%Mg_restart, 'ghprime', Atm(1)%sgh) call close_file(Atm(1)%Mg_restart) + Atm(1)%Mg_restart_is_open = .false. else call mpp_error(NOTE,'==> Warning from remap_restart: Expected file '//trim(fname)//' does not exist') endif @@ -749,6 +751,7 @@ subroutine remap_restart(Atm) if (Atm(1)%Lnd_restart_is_open) then call read_data(Atm(1)%Lnd_restart, 'oro', Atm(1)%oro) call close_file(Atm(1)%Lnd_restart) + Atm(1)%Lnd_restart_is_open = .false. else call mpp_error(NOTE,'==> Warning from remap_restart: Expected file '//trim(fname)//' does not exist') endif @@ -1463,11 +1466,13 @@ subroutine fv_io_write_BCs(Atm, timestamp) if (Atm%neststruct%BCfile_sw_is_open) then call write_restart_bc(Atm%neststruct%BCfile_sw) call close_file(Atm%neststruct%BCfile_sw) + Atm%neststruct%BCfile_sw_is_open = .false. endif if (Atm%neststruct%BCfile_ne_is_open) then call write_restart_bc(Atm%neststruct%BCfile_ne) call close_file(Atm%neststruct%BCfile_ne) + Atm%neststruct%BCfile_ne_is_open = .false. endif deallocate(all_pelist) @@ -1497,11 +1502,13 @@ subroutine fv_io_read_BCs(Atm) if (Atm%neststruct%BCfile_sw_is_open) then call read_restart_bc(Atm%neststruct%BCfile_sw, ignore_checksum=Atm%flagstruct%ignore_rst_cksum) call close_file(Atm%neststruct%BCfile_sw) + Atm%neststruct%BCfile_sw_is_open = .false. endif if (Atm%neststruct%BCfile_ne_is_open) then call read_restart_bc(Atm%neststruct%BCfile_ne, ignore_checksum=Atm%flagstruct%ignore_rst_cksum) call close_file(Atm%neststruct%BCfile_ne) + Atm%neststruct%BCfile_ne_is_open = .false. endif