From ea783b03d98c064dc2ec8dbbb93f20797f72d15b Mon Sep 17 00:00:00 2001 From: Philippe Blain Date: Thu, 6 May 2021 10:11:21 -0400 Subject: [PATCH] ice_calendar: fix hourly outputs with 'histfreq_n /= 1' In b720380 (Update Time Manager (#566), 2021-03-16), the computation of 'elapsed_hours' in ice_calendar::calendar was changed from elapsed_hours = int(ttime/3600) to elapsed_hours = elapsed_days * hours_per_day In the previous version, 'ttime' held the total number of seconds since the beginning of the run, such that 'elapsed_hours' correctly held the number of elapsed hours since the beginning of the run. Howeve, the new computation is incorrect; it does not take into account the hours elapsed into the current date, nor the fact that the run may have started at a different time than 00:00. This in turn leads to hourly outputs being written each hour even if 'histfreq_n /= 1'. Fix the computation. --- cicecore/shared/ice_calendar.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cicecore/shared/ice_calendar.F90 b/cicecore/shared/ice_calendar.F90 index 22b1f74d3..97a9c1eea 100644 --- a/cicecore/shared/ice_calendar.F90 +++ b/cicecore/shared/ice_calendar.F90 @@ -354,7 +354,7 @@ subroutine calendar() elapsed_years = myear - year_init elapsed_months = elapsed_years*months_per_year + mmonth - month_init elapsed_days = compute_days_between(year_init,month_init,day_init,myear,mmonth,mday) - elapsed_hours = elapsed_days * hours_per_day + elapsed_hours = elapsed_days * hours_per_day + hour - sec_init / seconds_per_hour call calendar_date2time(myear,mmonth,mday,msec,timesecs) !--- compute other stuff