From 0a7611056e1ef12ac828d184105755691e387413 Mon Sep 17 00:00:00 2001 From: Nick Szapiro Date: Wed, 16 Oct 2024 05:48:25 +0000 Subject: [PATCH 1/2] restart_fh using shr_is_restart_fh_mod --- cicecore/drivers/nuopc/cmeps/ice_comp_nuopc.F90 | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/cicecore/drivers/nuopc/cmeps/ice_comp_nuopc.F90 b/cicecore/drivers/nuopc/cmeps/ice_comp_nuopc.F90 index edf5d289a..ce2a7fd2b 100644 --- a/cicecore/drivers/nuopc/cmeps/ice_comp_nuopc.F90 +++ b/cicecore/drivers/nuopc/cmeps/ice_comp_nuopc.F90 @@ -55,6 +55,9 @@ module ice_comp_nuopc use ice_mesh_mod , only : ice_mesh_init_tlon_tlat_area_hm, ice_mesh_create_scolumn use ice_prescribed_mod , only : ice_prescribed_init use ice_scam , only : scol_valid, single_column +#ifndef CESMCOUPLED + use shr_is_restart_fh_mod, only : init_is_restart_fh, is_restart_fh, write_restartfh +#endif implicit none private @@ -1175,6 +1178,11 @@ subroutine ModelAdvance(gcomp, rc) endif endif +#ifndef CESMCOUPLED + write_restartfh = is_restart_fh(clock) + if (write_restartfh) force_restart_now = .true. +#endif + !-------------------------------- ! Unpack import state !-------------------------------- @@ -1289,6 +1297,7 @@ subroutine ModelSetRunClock(gcomp, rc) character(len=256) :: stop_option ! Stop option units integer :: stop_n ! Number until stop interval integer :: stop_ymd ! Stop date (YYYYMMDD) + integer :: dtime type(ESMF_ALARM) :: stop_alarm character(len=128) :: name integer :: alarmcount @@ -1379,6 +1388,12 @@ subroutine ModelSetRunClock(gcomp, rc) end if +#ifndef CESMCOUPLED + call ESMF_TimeIntervalGet( dtimestep, s=dtime, rc=rc ) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call init_is_restart_fh(mcurrTime, dtime, my_task == master_task) +#endif + !-------------------------------- ! Advance model clock to trigger alarms then reset model clock back to currtime !-------------------------------- From 4f6c505016ff20bc3f1419bb683353b9f1061480 Mon Sep 17 00:00:00 2001 From: Nick Szapiro Date: Thu, 17 Oct 2024 03:45:49 +0000 Subject: [PATCH 2/2] Only call init_is_restart_fh first time --- cicecore/drivers/nuopc/cmeps/ice_comp_nuopc.F90 | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/cicecore/drivers/nuopc/cmeps/ice_comp_nuopc.F90 b/cicecore/drivers/nuopc/cmeps/ice_comp_nuopc.F90 index ce2a7fd2b..01a90b509 100644 --- a/cicecore/drivers/nuopc/cmeps/ice_comp_nuopc.F90 +++ b/cicecore/drivers/nuopc/cmeps/ice_comp_nuopc.F90 @@ -1386,14 +1386,14 @@ subroutine ModelSetRunClock(gcomp, rc) call ESMF_AlarmSet(stop_alarm, clock=mclock, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - end if - #ifndef CESMCOUPLED - call ESMF_TimeIntervalGet( dtimestep, s=dtime, rc=rc ) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call init_is_restart_fh(mcurrTime, dtime, my_task == master_task) + call ESMF_TimeIntervalGet( dtimestep, s=dtime, rc=rc ) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call init_is_restart_fh(mcurrTime, dtime, my_task == master_task) #endif + end if + !-------------------------------- ! Advance model clock to trigger alarms then reset model clock back to currtime !--------------------------------