949 Correct handling of dt_min in integrators#960
Conversation
now the integrator makes a time step of at least dt_min, instead of potentially doing nothing except decreasing dt without limit. this breaks fsal steppers (in part. rk-dopri5, only used in tests and benchmarks), so they were disabled for now.
|
I fixed the issue using another version of the try_step method. However, this breaks the runge_kutta_dopri5 stepper due to a bug in boost. Since we currently only use it in testing and benchmarks, I decided to prevent it (and other FSAL steppers) to be used in the wrapper. @mknaranja Do you think its okay to disable FSAL steppers for now? Otherwise, the ControlledStepperWrapper would have to make a manual integration step whenever the normal try_step loop fails. This is not a terrible solution, but we potentially make a repeated integration step whenever dt==dt_min. The test TestOdeSecir.compareAgeResWithPreviousRunCashKarp currently fails since it uses an integration result with a time step < dt_min as reference. @MaxBetzDLR is it safe to just update the csv with a new integration result? |
by adding a test for all included adaptive integrators and expanding the documentation of IntegratorCore::step
This caused the TestOdeSecir.compare* tests to fail, since the tables used for comparison contained time steps smaller than dt_min. Also, the rel. tol. in TestOdeSecir.compareWithPreviousRun had to be increased, since it caused a reduction in time step size that does not occurs in TestOdeSecir.compareAgeResWithPreviousRun, which uses the same model setup, but with three age groups instead of one.
|
Currently, both ControlledStepperWrapper and RKIntegratorCore are allowed to make steps of size > dt_max, only if the function argument dt > dt_max. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #960 +/- ##
=======================================
Coverage 96.22% 96.23%
=======================================
Files 124 122 -2
Lines 9699 9684 -15
=======================================
- Hits 9333 9319 -14
+ Misses 366 365 -1 ☔ View full report in Codecov by Sentry. |
@reneSchm This is not good design we did. We should not allow that, adapt it and inform/warn on it. |
mknaranja
left a comment
There was a problem hiding this comment.
Hi @reneSchm
Thank you very much. I had looked at almost everything. I have mostly commenting and documentation suggestions. If someone could have a more detailed look on the new step method, that would be great though. If that's done, we can merge it.
Co-authored-by: Martin J. Kühn <62713180+mknaranja@users.noreply.github.com>
HenrZu
left a comment
There was a problem hiding this comment.
I looked at the step functions and they look correct and also well commented:)
One comment. Should we also adjust the default values for the minimum step sizes? (also in stepper_wrapper.h)
memilio/cpp/memilio/math/adapt_rk.h
Line 108 in afd4982
I don't think we should set a different dt_min, which scale would we even choose? Maybe we could set a dt_min in the simulation, but I would prefer to keep it model/executable specific. |
|
So I added a small warning when the given dt was out of bounds, and strangely enough it might have improved performance for some steppers?
Before logging (dae153c): With logging (b93c0e6): |
now the integrator makes a time step of at least dt_min, instead of potentially doing nothing except decreasing dt without limit. this breaks fsal steppers (in part. rk-dopri5, only used in tests and benchmarks), so they were disabled for now.
Changes and Information
Please briefly list the changes (main added features, changed items, or corrected bugs) made:
If need be, add additional information and what the reviewer should look out for in particular:
Merge Request - Guideline Checklist
Please check our git workflow. Use the draft feature if the Pull Request is not yet ready to review.
Checks by code author
Checks by code reviewer(s)
Closes #949