From 57290e24f83c468959a01d055828100aa8abeff1 Mon Sep 17 00:00:00 2001 From: Jim Edwards Date: Wed, 26 Jun 2024 07:15:37 -0600 Subject: [PATCH] merge to main, add timestamp to rpointer file name --- mediator/med_phases_restart_mod.F90 | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/mediator/med_phases_restart_mod.F90 b/mediator/med_phases_restart_mod.F90 index f2ffb911..c85e703e 100644 --- a/mediator/med_phases_restart_mod.F90 +++ b/mediator/med_phases_restart_mod.F90 @@ -5,7 +5,7 @@ module med_phases_restart_mod !----------------------------------------------------------------------------- use med_kind_mod , only : CX=>SHR_KIND_CX, CS=>SHR_KIND_CS, CL=>SHR_KIND_CL, R8=>SHR_KIND_R8 - use med_constants_mod , only : dbug_flag => med_constants_dbug_flag +! use med_constants_mod , only : dbug_flag => med_constants_dbug_flag use med_utils_mod , only : chkerr => med_utils_ChkErr use med_internalstate_mod , only : maintask, logunit, InternalState use med_internalstate_mod , only : ncomps, compname, compocn, complnd, compwav @@ -25,7 +25,7 @@ module med_phases_restart_mod logical :: write_restart_at_endofrun = .false. logical :: whead(2) = (/.true. , .false./) logical :: wdata(2) = (/.false., .true. /) - + integer, parameter:: dbug_flag = 2 character(*), parameter :: u_FILE_u = & __FILE__ @@ -302,7 +302,7 @@ subroutine med_phases_restart_write(gcomp, rc) trim(nexttimestr),'.nc' if (maintask) then - restart_pfile = "rpointer.cpl"//trim(cpl_inst_tag) + restart_pfile = "rpointer.cpl"//trim(cpl_inst_tag)//'.'//trim(nexttimestr) call ESMF_LogWrite(trim(subname)//" write rpointer file = "//trim(restart_pfile), ESMF_LOGMSG_INFO) open(newunit=unitn, file=restart_pfile, form='FORMATTED') write(unitn,'(a)') trim(restart_file) @@ -547,14 +547,21 @@ subroutine med_phases_restart_read(gcomp, rc) endif ! Get the restart file name from the pointer file - restart_pfile = "rpointer.cpl"//trim(cpl_inst_tag) + restart_pfile = "rpointer.cpl"//trim(cpl_inst_tag)//'.'//trim(currtimestr) if (maintask) then call ESMF_LogWrite(trim(subname)//" read rpointer file = "//trim(restart_pfile), ESMF_LOGMSG_INFO) open(newunit=unitn, file=restart_pfile, form='FORMATTED', status='old', iostat=ierr) + if (ierr < 0) then - call ESMF_LogWrite(trim(subname)//' rpointer file open returns error', ESMF_LOGMSG_INFO) - rc=ESMF_Failure - return + ! try without currtimestr + restart_pfile = "rpointer.cpl"//trim(cpl_inst_tag) + call ESMF_LogWrite(trim(subname)//" read rpointer file = "//trim(restart_pfile), ESMF_LOGMSG_INFO) + open(newunit=unitn, file=restart_pfile, form='FORMATTED', status='old', iostat=ierr) + if(ierr < 0) then + call ESMF_LogWrite(trim(subname)//' rpointer file open returns error', ESMF_LOGMSG_INFO) + rc=ESMF_Failure + return + end if end if read (unitn,'(a)', iostat=ierr) restart_file if (ierr < 0) then