@@ -543,6 +543,7 @@ function SciMLBase.remake_initialization_data(
543543 if u0 === missing && p === missing
544544 return odefn. initialization_data
545545 end
546+
546547 if ! (eltype (u0) <: Pair ) && ! (eltype (p) <: Pair )
547548 oldinitdata = odefn. initialization_data
548549 oldinitdata === nothing && return nothing
@@ -658,6 +659,18 @@ function SciMLBase.late_binding_update_u0_p(
658659 prob, sys:: AbstractSystem , u0, p, t0, newu0, newp)
659660 supports_initialization (sys) || return newu0, newp
660661 u0 === missing && return newu0, (p === missing ? copy (newp) : newp)
662+ # If the user passes `p` to `remake` but not `u0` and `u0` isn't empty,
663+ # and if the system supports initialization (so it has initial parameters),
664+ # and if the initialization solves for `u0`,
665+ # THEN copy the values of `Initial`s to `newu0`.
666+ if u0 === missing && newu0 != = nothing && p != = missing && supports_initialization (sys) && prob. f. initialization_data != = nothing && prob. f. initialization_data. initializeprobmap != = nothing
667+ if ArrayInterface. ismutable (newu0)
668+ copyto! (newu0, getu (sys, Initial .(unknowns (sys)))(newp))
669+ else
670+ T = StaticArrays. similar_type (newu0)
671+ newu0 = T (getu (sys, Initial .(unknowns (sys)))(newp))
672+ end
673+ end
661674 # non-symbolic u0 updates initials...
662675 if ! (eltype (u0) <: Pair )
663676 # if `p` is not provided or is symbolic
0 commit comments