From 2ee1389e28aeb87ca46b6e77c2e8a8d44375306d Mon Sep 17 00:00:00 2001 From: William Cooke Date: Tue, 6 Feb 2018 12:37:53 -0500 Subject: [PATCH] Add timestamp to intermediate iceberg restart files. Also corrects double tagging of ensemble name to iceberg restart filename. --- icebergs.F90 | 5 +++-- icebergs_io.F90 | 8 +++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/icebergs.F90 b/icebergs.F90 index dd16cab..38bf357 100644 --- a/icebergs.F90 +++ b/icebergs.F90 @@ -5161,16 +5161,17 @@ subroutine icebergs_stock_pe(bergs, index, value) end subroutine icebergs_stock_pe !> Write restart files -subroutine icebergs_save_restart(bergs) +subroutine icebergs_save_restart(bergs, time_stamp) ! Arguments type(icebergs), pointer :: bergs !< Container for all types and memory + character(len=*), intent(in), optional :: time_stamp !< Timestamp for restart file ! Local variables if (.not.associated(bergs)) return call mpp_clock_begin(bergs%clock_iow) call bergs_chksum(bergs, 'write_restart bergs') - call write_restart(bergs) + call write_restart(bergs, time_stamp) call mpp_clock_end(bergs%clock_iow) end subroutine icebergs_save_restart diff --git a/icebergs_io.F90 b/icebergs_io.F90 index 04d7d90..a99893d 100644 --- a/icebergs_io.F90 +++ b/icebergs_io.F90 @@ -101,9 +101,11 @@ subroutine ice_bergs_io_init(bergs, io_layout) end subroutine ice_bergs_io_init !> Write an iceberg restart file -subroutine write_restart(bergs) +subroutine write_restart(bergs, time_stamp) ! Arguments type(icebergs), pointer :: bergs !< Icebergs container +character(len=*), intent(in), optional :: time_stamp !< Timestamp for restart file + ! Local variables type(bond), pointer :: current_bond integer :: i,j,id @@ -201,7 +203,7 @@ subroutine write_restart(bergs) allocate(id_ij(nbergs)) - call get_instance_filename("icebergs.res.nc", filename) + filename = "icebergs.res.nc" call set_domain(bergs%grd%domain) call register_restart_axis(bergs_restart,filename,'i',nbergs) call set_meta_global(bergs_restart,'file_format_major_version',ival=(/file_format_major_version/)) @@ -287,7 +289,7 @@ subroutine write_restart(bergs) enddo ; enddo - call save_restart(bergs_restart) + call save_restart(bergs_restart, time_stamp) call free_restart_type(bergs_restart) deallocate( &