Skip to content

Commit

Permalink
Add testcase for initial du save
Browse files Browse the repository at this point in the history
  • Loading branch information
Keno authored and ChrisRackauckas committed Oct 27, 2023
1 parent ffbfee4 commit 1b46dc5
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions test/common_interface/ida.jl
Original file line number Diff line number Diff line change
Expand Up @@ -121,3 +121,13 @@ 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 that we're saving the correct initial data for du
function f_inital_data(du, u, p, t)
return [du[1] - (u[1] + 10.0)]
end
prob = DAEProblem(f_inital_data, [0.0], [1.0], (0.0, 1.0); differential_vars = [true])
sol = solve(prob, IDA())
# If this is one, it incorrectly saved u, if it is 0., it incorrectly solved
# the pre-init value rather than the post-init one.
@test sol(0.0, Val{1})[1] 11.0

0 comments on commit 1b46dc5

Please sign in to comment.