-
-
Notifications
You must be signed in to change notification settings - Fork 79
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
Option stop_at_tdt not correctly documented #307
Comments
This code is working:
|
Lets say only the documentation is wrong. It says:
at https://diffeq.sciml.ai/stable/basics/integrator/#SciMLBase.step! |
. Perhaps it would also be good to add the working example above to the documentation. Because if it is not added the only thing you see is:
Which does not work together with the option stop_at_tdt=true. |
What do you mean that doesn't work? |
Look at the initial example. It gives wrong output, it does not respect dt. |
In for i in 1:5
step!(integrator, dt, true)
for (u,t) in tuples(integrator)
@show u[18], t
end
end You're explicitly telling it to only use |
using OrdinaryDiffEq
prob = ODEProblem((u,p,t)->1.01u,1.01,(0.0,1.0))
integrator = init(prob,Tsit5())
for (u,t) in tuples(integrator)
@show u,t
end
It iterates as documented, and because it does what's documented it causes your "issue". |
That is very confusing. Why should the command:
actually cause the integration to continue? My understanding of this command is that it just collects the result of the last integration. |
It's an iterator that iterates by stepping. using OrdinaryDiffEq
prob = ODEProblem((u,p,t)->1.01u,1.01,(0.0,1.0))
integrator = init(prob,Tsit5())
for integ in integrator
@show integ.t
end
It's the standard Julia construct for stepping. I don't understand why you were using stepping to view terms when you didn't want stepping. |
No, it's an iterator, defined in the iteration section as an iterator. |
etc. It's all about different iterators to control and view stepping behavior in nice ways. |
Anyway, I think it would be helpful to add an example like this: dt = 0.1
t_en = 10.0
for i in 1:round(t_end/dt)
step!(integrator, dt, true)
u = integrator.u
t = integrator.t
@show u, t
end to the documentation. |
Agreed. |
|
for (u,t) in TimeChoiceIterator(integrator,0:dt:tend)
@show u,t
end might be the nicest way. |
But does this do the integration step-by-step with the possibility to update parameters after each step? |
Yes, it iterates to the next for (u,t) in TimeChoiceIterator(integrator,0:dt:tend)
@show u,t
integrator.p = ... # modify the parameter before continuing
end |
Great! |
The following code gives an unexpected output:
Output:
I would expect the results at 0.5, 1, 1.5, 2.0 and 2.5 seconds simulation time.
Full example: https://github.com/ufechner7/KiteViewer/blob/sim/src/RTSim_bug.jl
The text was updated successfully, but these errors were encountered: