From 42b642646e1abeca74e5f95e7710a26fcc070613 Mon Sep 17 00:00:00 2001 From: Jim Edwards Date: Thu, 26 Sep 2024 15:57:36 -0600 Subject: [PATCH 1/2] reduce orbital parameters output to log --- cicecore/drivers/nuopc/cmeps/ice_comp_nuopc.F90 | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/cicecore/drivers/nuopc/cmeps/ice_comp_nuopc.F90 b/cicecore/drivers/nuopc/cmeps/ice_comp_nuopc.F90 index ea0191fa1..c6b90f53a 100644 --- a/cicecore/drivers/nuopc/cmeps/ice_comp_nuopc.F90 +++ b/cicecore/drivers/nuopc/cmeps/ice_comp_nuopc.F90 @@ -1426,8 +1426,9 @@ subroutine ice_orbital_init(gcomp, clock, logunit, mastertask, rc) type(ESMF_Time) :: CurrTime ! current time integer :: year ! model year at current time integer :: orb_year ! orbital year for current orbital computation + integer, save :: prev_orb_year=0 ! orbital year for previous orbital computation logical :: lprint - logical :: first_time = .true. + logical, save :: first_time = .true. character(len=*) , parameter :: subname = "(cice_orbital_init)" !------------------------------------------------------------------------------- @@ -1509,23 +1510,20 @@ subroutine ice_orbital_init(gcomp, clock, logunit, mastertask, rc) return ! bail out endif end if - + lprint = .false. if (trim(orb_mode) == trim(orb_variable_year)) then call ESMF_ClockGet(clock, CurrTime=CurrTime, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return call ESMF_TimeGet(CurrTime, yy=year, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return orb_year = orb_iyear + (year - orb_iyear_align) - lprint = mastertask else orb_year = orb_iyear - if (first_time) then - lprint = mastertask - else - lprint = .false. - end if end if - + if (orb_year .ne. prev_orb_year) then + lprint = mastertask + prev_orb_year = orb_year + endif eccen = orb_eccen call shr_orb_params(orb_year, eccen, orb_obliq, orb_mvelp, obliqr, lambm0, mvelpp, lprint) From 2119908d6d213863fd9f82d67831be7e8ca3fe85 Mon Sep 17 00:00:00 2001 From: Jim Edwards Date: Fri, 27 Sep 2024 09:09:43 -0600 Subject: [PATCH 2/2] avoid printing in initialization as ice log is not yet ready --- cicecore/drivers/nuopc/cmeps/ice_comp_nuopc.F90 | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cicecore/drivers/nuopc/cmeps/ice_comp_nuopc.F90 b/cicecore/drivers/nuopc/cmeps/ice_comp_nuopc.F90 index c6b90f53a..597f1cdca 100644 --- a/cicecore/drivers/nuopc/cmeps/ice_comp_nuopc.F90 +++ b/cicecore/drivers/nuopc/cmeps/ice_comp_nuopc.F90 @@ -404,6 +404,7 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) ! Determine attributes - also needed in realize phase to get grid information !---------------------------------------------------------------------------- + ! Get orbital values ! Note that these values are obtained in a call to init_orbit in ice_shortwave.F90 ! if CESMCOUPLED is not defined @@ -1520,11 +1521,14 @@ subroutine ice_orbital_init(gcomp, clock, logunit, mastertask, rc) else orb_year = orb_iyear end if + if (orb_year .ne. prev_orb_year) then lprint = mastertask - prev_orb_year = orb_year + ! this prevents the orbital print happening before the log file is opened. + if (.not. first_time) prev_orb_year = orb_year endif eccen = orb_eccen + call shr_orb_params(orb_year, eccen, orb_obliq, orb_mvelp, obliqr, lambm0, mvelpp, lprint) if ( eccen == SHR_ORB_UNDEF_REAL .or. obliqr == SHR_ORB_UNDEF_REAL .or. &