Skip to content

Commit

Permalink
Merge pull request #1090 from SciML/myb/u0
Browse files Browse the repository at this point in the history
Always respect user provided `u0` override
  • Loading branch information
ChrisRackauckas authored Sep 30, 2024
2 parents d42314e + 832a359 commit 6bce332
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/solve.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1176,7 +1176,8 @@ function get_concrete_problem(prob, isadapt; kwargs...)
tspan_promote = promote_tspan(u0_promote, p, tspan, prob, kwargs)
f_promote = promote_f(prob.f, Val(SciMLBase.specialization(prob.f)), u0_promote, p,
tspan_promote[1])
if isconcreteu0(prob, tspan[1], kwargs) && typeof(u0_promote) === typeof(prob.u0) &&
if isconcreteu0(prob, tspan[1], kwargs) && prob.u0 === u0 &&
typeof(u0_promote) === typeof(prob.u0) &&
prob.tspan == tspan && typeof(prob.tspan) === typeof(tspan_promote) &&
p === prob.p && f_promote === prob.f
return prob
Expand Down
4 changes: 4 additions & 0 deletions test/downstream/prob_kwargs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,7 @@ prob = ODEProblem(lorenz, u0, tspan, alg = Tsit5())
@test_nowarn sol = solve(prob, reltol = 1e-6)
sol = solve(prob, reltol = 1e-6)
@test sol.alg isa Tsit5

new_u0 = rand(3)
sol = solve(prob, u0 = new_u0)
@test sol.prob.u0 === new_u0

0 comments on commit 6bce332

Please sign in to comment.