Skip to content

Commit dd16816

Browse files
feat: forward kwargs to solve in OverrideInit
1 parent f5b6ba7 commit dd16816

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

src/initialization.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,8 @@ function initialization_status(prob::AbstractSciMLProblem)
304304
iprob = prob.f.initialization_data.initializeprob
305305
isnothing(prob) && return nothing
306306

307-
nunknowns = iprob.u0 === nothing ? 0 : length(iprob.u0)
307+
iu0 = state_values(iprob)
308+
nunknowns = iu0 === nothing ? 0 : length(iu0)
308309
neqs = if __has_resid_prototype(iprob.f) && iprob.f.resid_prototype !== nothing
309310
length(iprob.f.resid_prototype)
310311
else

test/initialization.jl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,14 @@ end
203203
@test p 1.0
204204
@test success
205205
end
206+
@testset "with kwargs provided to `get_initial_values`" begin
207+
u0, p, success = SciMLBase.get_initial_values(
208+
prob, integ, fn, SciMLBase.OverrideInit(),
209+
Val(false); nlsolve_alg = NewtonRaphson(), abstol, reltol, u0 = [-1.0, 1.0])
210+
@test u0 [2.0, -2.0]
211+
@test p 1.0
212+
@test success
213+
end
206214
end
207215

208216
@testset "Solves with non-integrator value provider" begin

0 commit comments

Comments
 (0)