-
Notifications
You must be signed in to change notification settings - Fork 4
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
support output for dt < 1 #439
Conversation
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 looks fine to me (assuming that the output frequency translates well for the plots). I suppose this will all disappear when we use OrdinaryDiffEq for timestepping since they have an API for callback frequency.
I prefer having the output frequency as time units, not timestep units. If this is difficult using seconds, we can just use milliseconds internally. |
Looks like we want to keep specifying output in seconds and not time steps. @charleskawczynski are you ok with the proposed alternative to |
26bbfde
to
4468212
Compare
I'm fine with that if it works |
4468212
to
9173d84
Compare
Ended up with this:
It does not change the behaviour for cases where |
bors r+ |
Build succeeded: |
When running with
dt
< 1s we generate no output. This is because our output is decided based on:if mod(sim.TS.t, sim.Stats.frequency) == 0
which runs into rounding errors when the arguments are not integers. Seems like the namelist key is labelled frequency, but we use it in the code more like output interval.
We could instead start using it like this (i.e. more like a frequency - "every how many steps we should do output)". This way we would avoid floating point issues:
if mod(iter, sim.Stats.frequency) == 0
If we want to keep the current output specification, some ugly workaround solution could look like this:
if (sim.TS.t - sim.Stats.frequency * div(sim.TS.t, sim.Stats.frequency, RoundNearest)) < eps(1.0) * sim.TS.t_max
Let me know what you think. If we go with the integer friendly way I'm not sure if I should change something more in the NetCDF io files.