Skip to content

Commit

Permalink
ice_calendar: fix hourly outputs with 'histfreq_n /= 1'
Browse files Browse the repository at this point in the history
In b720380 (Update Time Manager (CICE-Consortium#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.
  • Loading branch information
phil-blain committed May 6, 2021
1 parent c8792a6 commit ea783b0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion cicecore/shared/ice_calendar.F90
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit ea783b0

Please sign in to comment.