Skip to content

Commit 6bce332

Browse files
Merge pull request #1090 from SciML/myb/u0
Always respect user provided `u0` override
2 parents d42314e + 832a359 commit 6bce332

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/solve.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1176,7 +1176,8 @@ function get_concrete_problem(prob, isadapt; kwargs...)
11761176
tspan_promote = promote_tspan(u0_promote, p, tspan, prob, kwargs)
11771177
f_promote = promote_f(prob.f, Val(SciMLBase.specialization(prob.f)), u0_promote, p,
11781178
tspan_promote[1])
1179-
if isconcreteu0(prob, tspan[1], kwargs) && typeof(u0_promote) === typeof(prob.u0) &&
1179+
if isconcreteu0(prob, tspan[1], kwargs) && prob.u0 === u0 &&
1180+
typeof(u0_promote) === typeof(prob.u0) &&
11801181
prob.tspan == tspan && typeof(prob.tspan) === typeof(tspan_promote) &&
11811182
p === prob.p && f_promote === prob.f
11821183
return prob

test/downstream/prob_kwargs.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,7 @@ prob = ODEProblem(lorenz, u0, tspan, alg = Tsit5())
1010
@test_nowarn sol = solve(prob, reltol = 1e-6)
1111
sol = solve(prob, reltol = 1e-6)
1212
@test sol.alg isa Tsit5
13+
14+
new_u0 = rand(3)
15+
sol = solve(prob, u0 = new_u0)
16+
@test sol.prob.u0 === new_u0

0 commit comments

Comments
 (0)