From f1249140e3de016f233ef1eba030f1a60fe11b0a Mon Sep 17 00:00:00 2001 From: Nicholas Szapiro <149816583+NickSzapiro-NOAA@users.noreply.github.com> Date: Fri, 27 Sep 2024 16:20:51 -0400 Subject: [PATCH 1/4] No ncat,ntrcr in call icepack_aggregate in ice_prescribed_mod.F90 --- cicecore/drivers/nuopc/cmeps/ice_prescribed_mod.F90 | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/cicecore/drivers/nuopc/cmeps/ice_prescribed_mod.F90 b/cicecore/drivers/nuopc/cmeps/ice_prescribed_mod.F90 index 2436783bc..f27c34fdd 100644 --- a/cicecore/drivers/nuopc/cmeps/ice_prescribed_mod.F90 +++ b/cicecore/drivers/nuopc/cmeps/ice_prescribed_mod.F90 @@ -446,8 +446,7 @@ subroutine ice_prescribed_phys() !-------------------------------------------------------------------- ! compute aggregate ice state and open water area !-------------------------------------------------------------------- - call icepack_aggregate(ncat = ncat, & - aicen = aicen(i,j,:,iblk), & + call icepack_aggregate(aicen = aicen(i,j,:,iblk), & trcrn = trcrn(i,j,1:ntrcr,:,iblk), & vicen = vicen(i,j,:,iblk), & vsnon = vsnon(i,j,:,iblk), & @@ -456,7 +455,6 @@ subroutine ice_prescribed_phys() vice = vice (i,j, iblk), & vsno = vsno (i,j, iblk), & aice0 = aice0(i,j, iblk), & - ntrcr = ntrcr, & trcr_depend = trcr_depend(1:ntrcr), & trcr_base = trcr_base(1:ntrcr,:), & n_trcr_strata = n_trcr_strata(1:ntrcr), & From ff7fd76118d47ccef6cb934b834161c6be5a9909 Mon Sep 17 00:00:00 2001 From: Nicholas Szapiro <149816583+NickSzapiro-NOAA@users.noreply.github.com> Date: Wed, 11 Dec 2024 11:04:22 -0500 Subject: [PATCH 2/4] Enable writing restarts that can be triggered at any forecast time ("restart_fh") via UFS configuration as for other components Part of https://github.com/ufs-community/ufs-weather-model/issues/2348 --- .../drivers/nuopc/cmeps/ice_comp_nuopc.F90 | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/cicecore/drivers/nuopc/cmeps/ice_comp_nuopc.F90 b/cicecore/drivers/nuopc/cmeps/ice_comp_nuopc.F90 index 7da8245a3..d4a43a3a9 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, is_restart_fh_type +#endif implicit none private @@ -96,6 +99,9 @@ module ice_comp_nuopc logical :: mastertask logical :: runtimelog = .false. logical :: restart_eor = .false. !End of run restart flag +#ifndef CESMCOUPLED + type(is_restart_fh_type) :: restartfh_info ! For flexible restarts in UFS +#endif integer :: start_ymd ! Start date (YYYYMMDD) integer :: start_tod ! start time of day (s) integer :: curr_ymd ! Current date (YYYYMMDD) @@ -1024,6 +1030,7 @@ subroutine ModelAdvance(gcomp, rc) character(char_len_long) :: restart_date character(char_len_long) :: restart_filename logical :: isPresent, isSet + logical :: write_restartfh character(len=*),parameter :: subname=trim(modName)//':(ModelAdvance) ' character(char_len_long) :: msgString !-------------------------------- @@ -1175,6 +1182,11 @@ subroutine ModelAdvance(gcomp, rc) endif endif +#ifndef CESMCOUPLED + call is_restart_fh(clock, restartfh_info, write_restartfh) + if (write_restartfh) force_restart_now = .true. +#endif + !-------------------------------- ! Unpack import state !-------------------------------- @@ -1289,6 +1301,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 @@ -1377,6 +1390,11 @@ subroutine ModelSetRunClock(gcomp, rc) call ESMF_AlarmSet(restart_alarm, clock=mclock, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return +#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, restartfh_info) +#endif end if !-------------------------------- From ba1392b4287f33b1297fe34b635f2ed4a621ac1e Mon Sep 17 00:00:00 2001 From: Nicholas Szapiro <149816583+NickSzapiro-NOAA@users.noreply.github.com> Date: Wed, 18 Dec 2024 11:29:06 -0500 Subject: [PATCH 3/4] Add 1 more #ifndef CESMCOUPLED to avoid unused variable warning for cesm --- cicecore/drivers/nuopc/cmeps/ice_comp_nuopc.F90 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cicecore/drivers/nuopc/cmeps/ice_comp_nuopc.F90 b/cicecore/drivers/nuopc/cmeps/ice_comp_nuopc.F90 index d4a43a3a9..8c80ad194 100644 --- a/cicecore/drivers/nuopc/cmeps/ice_comp_nuopc.F90 +++ b/cicecore/drivers/nuopc/cmeps/ice_comp_nuopc.F90 @@ -1030,7 +1030,9 @@ subroutine ModelAdvance(gcomp, rc) character(char_len_long) :: restart_date character(char_len_long) :: restart_filename logical :: isPresent, isSet +#ifndef CESMCOUPLED logical :: write_restartfh +#endif character(len=*),parameter :: subname=trim(modName)//':(ModelAdvance) ' character(char_len_long) :: msgString !-------------------------------- From 88da25bf6a6e8a4911a44a2538f7a057064ab26f Mon Sep 17 00:00:00 2001 From: Nicholas Szapiro <149816583+NickSzapiro-NOAA@users.noreply.github.com> Date: Wed, 18 Dec 2024 11:42:41 -0500 Subject: [PATCH 4/4] #ifndef for dtime here too --- cicecore/drivers/nuopc/cmeps/ice_comp_nuopc.F90 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cicecore/drivers/nuopc/cmeps/ice_comp_nuopc.F90 b/cicecore/drivers/nuopc/cmeps/ice_comp_nuopc.F90 index 8c80ad194..8ced569a5 100644 --- a/cicecore/drivers/nuopc/cmeps/ice_comp_nuopc.F90 +++ b/cicecore/drivers/nuopc/cmeps/ice_comp_nuopc.F90 @@ -1303,10 +1303,12 @@ 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 +#ifndef CESMCOUPLED + integer :: dtime +#endif character(len=*),parameter :: subname=trim(modName)//':(ModelSetRunClock) ' !--------------------------------