-
Notifications
You must be signed in to change notification settings - Fork 60
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
Bug fix for subroutine write_energy
when DT
<2
#749
Bug fix for subroutine write_energy
when DT
<2
#749
Conversation
The time type allows for the use of sub-second time increments ( Also, please explain your comment that just changing |
38aa808
to
6289582
Compare
Yes, we will definitely have more flexibility if could use I think MOM6 supports using time steps with a fractional second, but the diagnostics could be off the mark (in time axis literally) due to bugs in FMS. This is probably a case beyond the scope of this PR and MOM6 and needs further changes in FMS.
Upon further examination and considering that all time_type attributes are integers, the solution with a simple |
6289582
to
f449579
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is now a parsimonious code solution to the problem identified in the discussion of this PR.
Fix a bug with subroutine write_energy when using a DT<2. Otherwise, the energy outputs are written at wrong time steps. The reason was that time type divide is essentially a floor. So DT/2 = 0 if DT<2.
f449579
to
98f0a69
Compare
This has passed pipeline testing at https://gitlab.gfdl.noaa.gov/ogrp/mom6ci/MOM6/-/pipelines/25608. |
This PR fixes a bug with subroutine
write_energy
when using a DT<2.Otherwise, the energy outputs could be written at wrong time steps with extremely small time stepping size.
The reason was that time type divide is essentially a floor. So in the line in question, dt_force/2 = 0 if dt_force<2. And energy is always written at the following time step, rather than when day==CS%write_energy_time.
The patch is a bit ugly.
dt_force/2
and<=
(rather than <) are necessary for round-off considerations.time_type
and a real number. (operator(//) is betweentime_type
variables and operator(*) is for atime_type
and an integer)