Skip to content
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

Fix handling of small timesteps #423

Merged
merged 2 commits into from
Dec 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions src/common_interface/solve.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1415,9 +1415,7 @@ function DiffEqBase.solve!(integrator::AbstractSundialsIntegrator; early_free =
integrator.userfun.p = integrator.p
solver_step(integrator, tstop)
integrator.t = first(integrator.tout)
if integrator.t == integrator.tprev
integrator.flag = -3
end
# NB: CVode, ARKode may warn and then recover if integrator.t == integrator.tprev so don't flag this as an error
integrator.flag < 0 && break
handle_callbacks!(integrator) # this also updates the interpolation
integrator.flag < 0 && break
Expand Down
2 changes: 1 addition & 1 deletion test/common_interface/ida.jl
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ isapprox(only(sol.u[end]), exp(1), rtol = 1e-3)
f_noconverge(out, du, u, p, t) = out .= [du[1] + u[1] / (t - 1)]
prob = DAEProblem(f_noconverge, [1.0], [1.0], (0, 2); differential_vars = [true])
sol = solve(prob, IDA())
@test !(sol.retcode in (ReturnCode.Success, ReturnCode.MaxIters))
@test !(sol.retcode in (ReturnCode.Success, ))

# Test that we're saving the correct initial data for du
function f_inital_data(du, u, p, t)
Expand Down
Loading