Skip to content

Commit ab41d7a

Browse files
fix: fix initialization_status for SCCNonlinearProblem initprob
1 parent dd16816 commit ab41d7a

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

src/initialization.jl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,8 +216,10 @@ Keyword arguments:
216216
If the former is `nothing`, this keyword argument will be used. If it is also not provided,
217217
an error will be thrown.
218218
219+
All additional keyword arguments are forwarded to `solve`.
220+
219221
In case the initialization problem is trivial, `nlsolve_alg`, `abstol` and `reltol` are
220-
not required.
222+
not required. `solve` is also not called.
221223
"""
222224
function get_initial_values(prob, valp, f, alg::OverrideInit,
223225
iip::Union{Val{true}, Val{false}}; nlsolve_alg = nothing, abstol = nothing, reltol = nothing, kwargs...)
@@ -257,7 +259,7 @@ function get_initial_values(prob, valp, f, alg::OverrideInit,
257259
else
258260
throw(OverrideInitNoTolerance(:reltol))
259261
end
260-
nlsol = solve(initprob, nlsolve_alg; abstol = _abstol, reltol = _reltol)
262+
nlsol = solve(initprob, nlsolve_alg; abstol = _abstol, reltol = _reltol, kwargs...)
261263
success = SciMLBase.successful_retcode(nlsol)
262264
end
263265

test/initialization.jl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,15 @@ end
270270
@test success
271271
end
272272

273+
@testset "Initialization status for `SCCNonlinearProblem`" begin
274+
initprob = SCCNonlinearProblem([initprob], [Returns(nothing)])
275+
initialization_data = SciMLBase.OverrideInitData(
276+
initprob, nothing, nothing, nothing)
277+
fn = ODEFunction(rhs2; initialization_data)
278+
prob = ODEProblem(fn, [2.0, 0.0], (0.0, 1.0), 0.0)
279+
@test SciMLBase.initialization_status(prob) == SciMLBase.FULLY_DETERMINED
280+
end
281+
273282
@testset "Trivial initialization" begin
274283
initprob = NonlinearProblem(Returns(nothing), nothing, [1.0])
275284
update_initializeprob! = function (iprob, integ)

0 commit comments

Comments
 (0)