From e9e5973bb9ec82dc60b1477c731f30fe2db05921 Mon Sep 17 00:00:00 2001 From: mhrib Date: Tue, 13 Apr 2021 18:08:12 +0000 Subject: [PATCH 1/4] Remove hc_jday. Not used anymore after introducing of new ice_calendar --- cicecore/shared/ice_calendar.F90 | 48 -------------------------------- 1 file changed, 48 deletions(-) diff --git a/cicecore/shared/ice_calendar.F90 b/cicecore/shared/ice_calendar.F90 index 8158313d9..4d7ae378f 100644 --- a/cicecore/shared/ice_calendar.F90 +++ b/cicecore/shared/ice_calendar.F90 @@ -36,7 +36,6 @@ module ice_calendar public :: set_date_from_timesecs ! set model date from time in seconds ! (relative to init date) ! needed for binary restarts - public :: hc_jday ! converts "calendar" date to HYCOM julian day ! semi-private, only used directly by unit tester public :: compute_elapsed_days ! compute elapsed days since 0000-01-01 @@ -916,53 +915,6 @@ subroutine calendar_time2date(atimesecs,ayear,amon,aday,asec,year_ref,mon_ref,da end subroutine calendar_time2date -!======================================================================= - - real(kind=dbl_kind) function hc_jday(iyear,imm,idd,ihour) -!-------------------------------------------------------------------- -! converts "calendar" date to HYCOM julian day: -! 1) year,month,day,hour (4 arguments) -! 2) year,doy,hour (3 arguments) -! -! HYCOM model day is calendar days since 31/12/1900 -!-------------------------------------------------------------------- - real(kind=dbl_kind) :: dtime - integer(kind=int_kind) :: iyear,iyr,imm,idd,idoy,ihr - integer(kind=int_kind), optional :: ihour - integer (kind=int_kind) :: n - - if (present(ihour)) then - !----------------- - ! yyyy mm dd HH - !----------------- - iyr=iyear-1901 - dtime = floor(365.25_dbl_kind*iyr)*c1 + idd*c1 + ihour/24._dbl_kind - if (mod(iyr,4)==3) then - do n = 1,imm-1 - dtime = dtime + daymo366(n) - enddo - else - do n = 1,imm-1 - dtime = dtime + daymo365(n) - enddo - endif - - else - !----------------- - ! yyyy DOY HH - !----------------- - ihr = idd ! redefine input - idoy = imm ! redefine input - iyr = iyear - 1901 - dtime = floor(365.25_dbl_kind*iyr)*c1 + idoy*c1 + ihr/24._dbl_kind - - endif - - hc_jday=dtime - - return - end function hc_jday - !======================================================================= end module ice_calendar From aa1d44cc10cffbb6719ee75d5dc489d280b8637d Mon Sep 17 00:00:00 2001 From: mhrib Date: Tue, 13 Apr 2021 18:09:04 +0000 Subject: [PATCH 2/4] Calculate "hc_jday" inline using compute_days_between and _init fields from ice_calendar --- cicecore/cicedynB/general/ice_forcing.F90 | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) mode change 100644 => 100755 cicecore/cicedynB/general/ice_forcing.F90 diff --git a/cicecore/cicedynB/general/ice_forcing.F90 b/cicecore/cicedynB/general/ice_forcing.F90 old mode 100644 new mode 100755 index d18b1ccd7..eeabc8ce1 --- a/cicecore/cicedynB/general/ice_forcing.F90 +++ b/cicecore/cicedynB/general/ice_forcing.F90 @@ -24,7 +24,8 @@ module ice_forcing use ice_communicate, only: my_task, master_task use ice_calendar, only: istep, istep1, & msec, mday, mmonth, myear, yday, daycal, & - daymo, days_per_year, hc_jday + daymo, days_per_year, compute_days_between, & + year_init, month_init, day_init, sec_init use ice_fileunits, only: nu_diag, nu_forcing use ice_exit, only: abort_ice use ice_read_write, only: ice_open, ice_read, & @@ -4607,8 +4608,12 @@ subroutine hycom_atm_data call icepack_query_parameters(Tffresh_out=Tffresh) call icepack_query_parameters(secday_out=secday) - ! current time in HYCOM jday units - hcdate = hc_jday(myear,0,0)+ yday+msec/secday + ! current time in HYCOM jday units (HYCOM ref year: 1900,12,31,00,00) + hcdate = real(compute_days_between(1900,12,31, & + myear +year_init -1, & + mmonth+month_init-1, & + mday +day_init -1) & + ) + (msec +sec_init)/secday ! Init recnum try recnum=min(max(oldrecnum,1),Njday_atm-1) From 7e32f5b82a7579a921b515c99b0ae099d6b8f9a8 Mon Sep 17 00:00:00 2001 From: mhrib Date: Fri, 16 Apr 2021 00:06:10 +0000 Subject: [PATCH 3/4] Correct hcdate using "compute_days_between" --- cicecore/cicedynB/general/ice_forcing.F90 | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/cicecore/cicedynB/general/ice_forcing.F90 b/cicecore/cicedynB/general/ice_forcing.F90 index eeabc8ce1..df888620c 100755 --- a/cicecore/cicedynB/general/ice_forcing.F90 +++ b/cicecore/cicedynB/general/ice_forcing.F90 @@ -4608,12 +4608,8 @@ subroutine hycom_atm_data call icepack_query_parameters(Tffresh_out=Tffresh) call icepack_query_parameters(secday_out=secday) - ! current time in HYCOM jday units (HYCOM ref year: 1900,12,31,00,00) - hcdate = real(compute_days_between(1900,12,31, & - myear +year_init -1, & - mmonth+month_init-1, & - mday +day_init -1) & - ) + (msec +sec_init)/secday + ! current time in HYCOM jday units (HYCOM ref year: 1900,12,31,000000) + hcdate = real(compute_days_between(1900,12,31,myear,mmonth,mday)) + msec/secday ! Init recnum try recnum=min(max(oldrecnum,1),Njday_atm-1) From 6322aa5e786a38a49549fd57983e83ef80f349dd Mon Sep 17 00:00:00 2001 From: mhrib Date: Fri, 16 Apr 2021 00:34:33 +0000 Subject: [PATCH 4/4] Remove unused variables from ice_calendar --- cicecore/cicedynB/general/ice_forcing.F90 | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/cicecore/cicedynB/general/ice_forcing.F90 b/cicecore/cicedynB/general/ice_forcing.F90 index df888620c..186e50f6c 100755 --- a/cicecore/cicedynB/general/ice_forcing.F90 +++ b/cicecore/cicedynB/general/ice_forcing.F90 @@ -24,8 +24,7 @@ module ice_forcing use ice_communicate, only: my_task, master_task use ice_calendar, only: istep, istep1, & msec, mday, mmonth, myear, yday, daycal, & - daymo, days_per_year, compute_days_between, & - year_init, month_init, day_init, sec_init + daymo, days_per_year, compute_days_between use ice_fileunits, only: nu_diag, nu_forcing use ice_exit, only: abort_ice use ice_read_write, only: ice_open, ice_read, &