-
Notifications
You must be signed in to change notification settings - Fork 27
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
Interpolated stats #203
Interpolated stats #203
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.
Looks good, this is more or less how I thought to do it as well. But the initialisation for HDF5Output
s isn't quite right I think (unless I've missed something?)
I thought I'd got this finished, but in its current state I get an error in the tests: HDF5 vs Memory: Test Failed at C:\Users\John\.julia\dev\Luna\test\test_output.jl:152
Expression: read((file["stats"])["ω0"]) == (mem.data["stats"])["ω0"] This works fine on current master. I'm struggling to understand how this occurs. All other tests pass, including the few new ones I added, apart from the frequency centroid. |
The problem isn't just with ω0, it's all the stats arrays. Just looking into how best to fix this. |
As an additional issue, your added check: if ts != t
append_stats!(o, o.statsfun(y, t, dt))
end doesn't actually do anything-- |
(and yes I realised I suggested this change) |
That's weird. If I comment out just the |
That's because the test for the z stat isn't in the test file. I added it just now while debugging. |
This can be fixed (and probably should be) by forcing the RK45 solver to finish precisely # make sure we don't propagate beyond the end
if (s.tn + s.dtn) > tmax
s.dtn = tmax-s.tn
end in the main loop in while s.tn < tmax
[...] instead of I have your branch checked out so could push it to this PR. Just running the whole test suite. |
OK, just remember to check for too small step size, which can also cause numerical issues. |
Well, that was the point. The interpolated field is very slightly different from the non-interpolated one. |
The best fix (IMO) is to make the propghataor step to each save position, the old fashioned way, for a very slight loss of performance (probably negligible) but increase in precision. |
Sure we can think about that. It's a much bigger overhaul of the Luna internals though, so definitely not going to happen quickly. |
Why was this closed? I suppose we could open an issue to cover the same point. But this was a useful reminder to make the propagator stop at exactly the saved steps and not use interpolation. I remember in fnfep the interpolation (done in the same way as in Luna) didn't help much for any decently complex simulation anyway. |
See #159, no idea why |
This is an attempt to fix #202
It saves stats at every natural step point (as previously) but also at every saved grid point based on the interpolated field.
Roughly tested so far.