-
-
Notifications
You must be signed in to change notification settings - Fork 22
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
Add tspan option to DynamicSS #8
Conversation
src/solve.jl
Outdated
_prob = ODEProblem(prob.f,prob.u0,tspan,prob.p) | ||
sol = solve(_prob,alg.alg,args...;kwargs..., | ||
callback=TerminateSteadyState(alg.abstol,alg.reltol)) | ||
if sol.t[end] ≈ _prob.tspan[end] |
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.
I feel dumb to do this. Is =
safer? (e.g., when u0
happened to be a steady state) Or we need a callback that sets a flag? Maybe it's better to have a :Terminated
return code which is set by terminate!
.
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.
==
is safer. The handling should make this exact.
If we go with In function __terminate! end
function terminate!(integrator)
__terminate!(integrator)
integrator.sol = solution_new_retcode(integrator.sol, :Terminated)
end In function DiffEqBase.__terminate!(integrator::ODEIntegrator)
integrator.opts.tstops.valtree = typeof(integrator.opts.tstops.valtree)()
end Also, maybe define a simple function so that it's easy to support compatibility for common cases: iserror(sol) = !(sol.retcode in (:Success, :Terminated)) |
Honestly I think the return codes should be enums, so if we redo them we should go all the way there. |
Yeees! enum retcode would be really nice. |
I'll merge when tests pass. But the retcode changes of adding a terminate and changing to enums is something that should get followup when we have time. |
This should get docs |
which is added in SciML/SteadyStateDiffEq.jl#8
You can limit the solver by
maxiters
but sometimes it's handy to stop it via the simulated timetspan
.