Skip to content

Commit

Permalink
Update flush implementation, fix unit number bug and check that
Browse files Browse the repository at this point in the history
files are open at the end of the run before flushing.
  • Loading branch information
apcraig committed Aug 28, 2024
1 parent 446ce00 commit 996ba39
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
22 changes: 16 additions & 6 deletions configuration/driver/icedrv_MAIN.F90
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ program icedrv
implicit none

integer n
logical openflag
character(len=*), parameter :: subname='(icedrv)'

!-----------------------------------------------------------------
Expand All @@ -55,15 +56,24 @@ program icedrv

write(ice_stdout, *) "ICEPACK COMPLETED SUCCESSFULLY "

call icedrv_system_flush(ice_stdout)
close (ice_stdout)
inquire(unit=ice_stdout,opened=openflag)
if (openflag) then
call icedrv_system_flush(ice_stdout)
close (ice_stdout)
endif

call icedrv_system_flush(nu_diag)
close (nu_diag)
inquire(unit=nu_diag,opened=openflag)
if (openflag) then
call icedrv_system_flush(nu_diag)
close (nu_diag)
endif

do n = 1, nx
call icedrv_system_flush(nu_diag_out+n+1)
close (nu_diag_out+n-1)
inquire(unit=nu_diag_out+n-1,opened=openflag)
if (openflag) then
call icedrv_system_flush(nu_diag_out+n-1)
close (nu_diag_out+n-1)
endif
enddo

end program icedrv
Expand Down
3 changes: 1 addition & 2 deletions configuration/driver/icedrv_diagnostics.F90
Original file line number Diff line number Diff line change
Expand Up @@ -267,13 +267,12 @@ subroutine runtime_diags (dt)
write(nu_diag_out+n-1,901) 'isotopic conc chg = ',pdiso(n,k),k
enddo
endif
call icedrv_system_flush(nu_diag_out+n-1)
end do
899 format (43x,a24)
900 format (a25,2x,f24.17)
901 format (a25,2x,f24.17,i6)

call icedrv_system_flush(nu_diag_out+n-1)

end subroutine runtime_diags

!=======================================================================
Expand Down

0 comments on commit 996ba39

Please sign in to comment.