Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Increase precision of time handling #833

Merged
merged 4 commits into from
Aug 16, 2018

Conversation

Hallberg-NOAA
Copy link
Collaborator

Replaced the use of set_time and get_time with real_to_time_type and
time_type_to_real to increase the precision of handling time by allowing the
sub-second ticks to be used effectively, and thereby permitting the use of
fractional second timesteps within MOM6. This modification could change answers
in cases where times are not an integer number of seconds. However, all
existing test cases only use times that are an integer number of seconds, so the
answers are bitwise identical in the test cases.

  Replaced the use of set_time and get_time with real_to_time_type and
time_type_to_real to increase the precision of handling time by allowing the
sub-second ticks to be used effectively, and thereby permitting the use of
fractional second timesteps within MOM6.  This modification could change answers
in cases where times are not an integer number of seconds.  However, all
existing test cases only use times that are an integer number of seconds, so the
answers are bitwise identical in the test cases.
  The previous commit wrote and read the real time written to the restart files
in seconds, not units of days (86400 seconds) as was traditionally done.  This
meant that while the restarts were internally consistent, they were incompatible
with the restart files from any other versions of MOM6.  The real times written
to and read from the restart files have been reverted to be in days (i.e. 86400
seconds).  All answers are bitwise identical.
  Added an alternate implementation of the FMS function real_to_time_type that
is accurate over a larger range of input values.  With 32 bit signed integers,
this new version should work over the entire valid range (2^31 days or ~5.8835
million years) of time_types, whereas the standard version in the FMS
time_manager stops working correctly for conversions of times greater than 2^31
seconds (~68.1 years).  At some point the FMS version should be upgraded, at
which point real_to_time could become a wrapper to the FMS version.  All answers
in the test cases are bitwise identical, but there is a new public interface.
  Use the new function real_to_time in place of the equivalent FMS function
real_to_time_type throughout the MOM6 code.  In some cases, the module use
statements needed to be change dto go via the MOM_time_manager, rather than
directly to the FMS time_manager_mod.  All answers in the test cases are bitwise
identical, and any problems with long times due to the previous commit using
real_to_time_type should be averted.
@Hallberg-NOAA
Copy link
Collaborator Author

This PR was tested with https://gitlab.gfdl.noaa.gov/ogrp/MOM6/pipelines/5367 and passed.

@adcroft adcroft merged commit 9324655 into mom-ocean:dev/gfdl Aug 16, 2018
@Hallberg-NOAA Hallberg-NOAA deleted the better_time_precision branch July 30, 2021 19:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants