I have the following code:
using DifferentialEquations, Sundials, StaticArrays using Revise if ! @isdefined KPS3 includet("../src/KPS3.jl") using .KPS3 end my_state = KPS3.get_state() clear(my_state) y0, yd0 = KPS3.init(my_state) tspan = (0.0, 0.05) # time span; fails when changed to (0.0, 0.06) differential_vars = ones(Bool, 36) prob = DAEProblem(residual!, yd0, y0, tspan, differential_vars=differential_vars) sol = solve(prob, IDA(), saveat=0.001, abstol=0.01, reltol=0.001) time = sol.t println(sol.retcode) pos_x = sol[3*5+1, :] pos_z = sol[3*5+3, :]
It works fine. You can check it out here: GitHub - ufechner7/KiteViewer at sim
(careful, use branch sim)
But if I increase the simulation time to 0.06 seconds it fails with the following error
julia> include("src/RTSim.jl") [IDAS ERROR] IDASolve At t = 0.0599924 and h = 2.40789e-162, the corrector convergence failed repeatedly or with |h| = hmin. 3.462572 seconds (10.40 M allocations: 599.441 MiB, 15.08% gc time) ConvergenceFailure
I would like to set the following parameters of the solver to make it work:
inith = 0.002 maxord = 3 pos_tol = 2.0/ 100.0 vel_tol = pos_tol / 60.0 atol = vel_tol * ones(36) for i in 1:18 atol[i] = pos_tol end rtol = 1e-3
The names I am using here are coming from the Python/ Assimulo code that I am converting to Julia,
so I might have to use slightly different names. (See: IDA — Assimulo 3.0 documentation)
Special question: Can I use arrays for the absolute end the relative tolerance?
Any ideas how to set inith, maxord, rtol and atol when using IDA from DifferentialEquations?