We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
reinit!(integrator, u0) currently allocates a lot due to reinit_dae. It would be great if these allocations could be reduced.
reinit!(integrator, u0)
reinit_dae
In this MWE, reinit_dae causes around 1000 allocations:
using ModelingToolkit, OrdinaryDiffEq using ModelingToolkit: D_nounits as D, t_nounits as t, setu, setp, getu Ts = 0.1 @mtkmodel Pendulum begin @parameters begin g = 9.8 L = 0.4 K = 1.2 m = 0.3 τ = 0.0 # input end @variables begin θ(t) = 0.0 # state ω(t) = 0.0 # state y(t) # output end @equations begin D(θ) ~ ω D(ω) ~ -g/L*sin(θ) - K/m*ω + τ/m/L^2 y ~ θ * 180 / π end end @mtkbuild mtk_model = Pendulum() prob = ODEProblem(mtk_model, nothing, (0.0, Ts)) integrator = OrdinaryDiffEq.init(prob, Tsit5(); dt=Ts, abstol=1e-8, reltol=1e-8, save_on=false, save_everystep=false) @time reinit!(integrator; reinit_dae=true) # 1.05k allocs @time reinit!(integrator; reinit_dae=false) # 6 allocs
From this discussion on discourse.
The text was updated successfully, but these errors were encountered:
AayushSabharwal
No branches or pull requests
reinit!(integrator, u0)
currently allocates a lot due toreinit_dae
. It would be great if these allocations could be reduced.In this MWE,
reinit_dae
causes around 1000 allocations:From this discussion on discourse.
The text was updated successfully, but these errors were encountered: