Skip to content

fix: propagate warn_initialize_determined in remake #3516

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
6 changes: 3 additions & 3 deletions src/systems/nonlinear/initializesystem.jl
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ function is_parameter_solvable(p, pmap, defs, guesses)
end

function SciMLBase.remake_initialization_data(
sys::AbstractSystem, odefn, u0, t0, p, newu0, newp)
sys::AbstractSystem, odefn, u0, t0, p, newu0, newp, kwargs...)
if u0 === missing && p === missing
return odefn.initialization_data
end
Expand Down Expand Up @@ -575,7 +575,7 @@ function SciMLBase.remake_initialization_data(
resid_prototype = calculate_resid_prototype(
length(oldinitprob.f.resid_prototype), new_initu0, new_initp))
end
initprob = remake(oldinitprob; f = newf, u0 = new_initu0, p = new_initp)
initprob = remake(oldinitprob; f = newf, u0 = new_initu0, p = new_initp, kwargs...)
return SciMLBase.OverrideInitData(initprob, oldinitdata.update_initializeprob!,
oldinitdata.initializeprobmap, oldinitdata.initializeprobpmap)
end
Expand Down Expand Up @@ -648,7 +648,7 @@ function SciMLBase.remake_initialization_data(
u0map, pmap, defs, cmap, dvs, ps)
kws = maybe_build_initialization_problem(
sys, op, u0map, pmap, t0, defs, guesses, missing_unknowns;
use_scc, initialization_eqs, allow_incomplete = true)
use_scc, initialization_eqs, allow_incomplete = true, kwargs...)
return get(kws, :initialization_data, nothing)
end

Expand Down
8 changes: 8 additions & 0 deletions test/initializationsystem.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1475,4 +1475,12 @@ end
@test SciMLBase.successful_retcode(sol)
@test sol.ps[Γ[1]] ≈ 5.0
end

@testset "warn_initialize_determined propagates through remake" begin
u0 = [X1 => 1.0, X2 => 2.0]
ps = [k1 => 0.1, k2 => 0.2, Γ => [5.0]]
@test_nowarn prob = Problem(nlsys, u0, ps, warn_initialize_determined = false)
@test_nowarn prob2 = remake(prob; p = [k2 => 2.], warn_initialize_determined = false)
end
end

Loading