-
-
Notifications
You must be signed in to change notification settings - Fork 230
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
Integrator interface for manually checking integrator.sol.retcode? #276
Comments
Yeah it would be good to unify this. StochasticDiffEq.jl could probably use the same one. |
Cool. Do you want PRs for this in DiffEqBase, OrdinaryDiffEq, StochasticDiffEq, and DiffEqDocs?
Do you want to define But I see that the current code is effectively identical so I guess it's doable: @@ -1,7 +1,7 @@
-@def ode_exit_conditions begin
+@def sde_exit_condtions begin
if integrator.iter > integrator.opts.maxiters
if integrator.opts.verbose
- warn("Interrupted. Larger maxiters is needed.")
+ warn("Max Iters Reached. Aborting")
end
postamble!(integrator)
integrator.sol = solution_new_retcode(integrator.sol,:MaxIters)
@@ -23,7 +23,7 @@
integrator.sol = solution_new_retcode(integrator.sol,:Unstable)
return integrator.sol
end
- if integrator.last_stepfail && !integrator.opts.adaptive
+ if integrator.last_stepfail && !integrator.opts.adaptive # Only false if doubled
if integrator.opts.verbose
warn("Newton steps could not converge and algorithm is not adaptive. Use a lower dt.")
end |
They've been almost identical for like a year now, and I am not seeing why it would change. The interface specifies what they should be doing here, and so they both implement it. It's probably easier to handle together since every change so far has required two duplicate commits. |
I see. That makes sense. |
Some bike-shedding:
I like Another question: is returning |
It should be |
@ChrisRackauckas Thanks for the merges! |
From grepping
solution_new_retcode
OrdinaryDiffEq/src, it looks likeretcode
is set only via@ode_exit_conditions
(and sosolve!
). Is it correct?If so, I suppose there is no integrator interface for checking the "healthiness" (retcode) of the integrator. It would be nice to have such an interface.
How about something like
check_code(integrator)
which just returns one of the Return Codes? For OrdinaryDiffEq, it would be straight forward to implement (untested; it was just copy-and-paste + ε of@ode_exit_conditions
):The bonus is that it fixes a possible "bug" in the integrator iterator interface that it was not setting the retcode (not sure if it was intended, though).
The text was updated successfully, but these errors were encountered: