Increase precision of time handling#833
Merged
Merged
Conversation
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.
Collaborator
Author
|
This PR was tested with https://gitlab.gfdl.noaa.gov/ogrp/MOM6/pipelines/5367 and passed. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.