Opened 7 years ago

Closed 7 years ago

#734 closed bug (Fixed)

Important: Corrected bug in dateclock.F (routine caldate)

Reported by: arango Owned by:
Priority: major Milestone: Release ROMS/TOMS 3.7
Component: Nonlinear Version: 3.7
Keywords: Cc:

Description

Corrected a bug in the routine caldate (module dateclock.F) when computing the fractional hour and fractional minutes. This only affects an application that uses the DIURNAL_SRFLUX, which modulate the shortwave radiation SRFLX (read and interpolated elsewhere) by the local diurnal cycle (a function of longitude, latitude, and day-of-year) using the Albedo equations.

We need to call caldate for the Albedo equations:

    CALL caldate (tdays(ng), yd_r8=yday, h_r8=hour)

Here the fractional hour of the date was not computed correctly.

I was tracking why ROMS was not producing the same solution as before the change to the Calendar/Date/Clock update (src:ticket:724). It turns out that difference in the solution is due to round-off.

The new routines compute and more exact date variables because we now use the floating-point rounding function with a Fuzzy or Tolerant Floor function:

     seconds=DayFraction*86400.0_r8
     CT=3.0_r8*EPSILON(seconds)             ! comparison tolerance
     seconds=ROUND(seconds, CT)             ! tolerant round function

The ROUND function eliminates round-off by improving the floating point representation in the computer.

So if you are using the option DIURNAL_SRFLUX the solutions are not reproducible because of the round-off. The solutions with the new code are more precise!

Change History (1)

comment:1 by arango, 7 years ago

Resolution: Fixed
Status: newclosed
Note: See TracTickets for help on using tickets.