Skip to content

Commit 2f11d43

Browse files
Merge pull request #1081 from SciML/ChrisRackauckas-patch-2
`nothing` is a perfectly valid nonlinear solver algorithm
2 parents a2258d9 + d8efe11 commit 2f11d43

File tree

3 files changed

+10
-9
lines changed

3 files changed

+10
-9
lines changed

src/initialization.jl

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -267,9 +267,6 @@ function get_initial_values(prob, valp, f, alg::OverrideInit,
267267
success = true
268268
else
269269
nlsolve_alg = something(nlsolve_alg, alg.nlsolve, Some(nothing))
270-
if nlsolve_alg === nothing && state_values(initprob) !== nothing
271-
throw(OverrideInitMissingAlgorithm())
272-
end
273270
if alg.abstol !== nothing
274271
_abstol = alg.abstol
275272
elseif abstol !== nothing

test/downstream/initialization.jl

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -241,9 +241,11 @@ end
241241
@test SciMLBase.initialization_status(prob) == SciMLBase.FULLY_DETERMINED
242242
integ = init(prob; initializealg = NoInit())
243243

244-
@testset "Errors without `nlsolve_alg`" begin
245-
@test_throws SciMLBase.OverrideInitMissingAlgorithm SciMLBase.get_initial_values(
246-
prob, integ, fn, SciMLBase.OverrideInit(), Val(false))
244+
@testset "Works without `nlsolve_alg`" begin
245+
abstol = 1e-10
246+
reltol = 1e-8
247+
SciMLBase.get_initial_values(
248+
prob, integ, fn, SciMLBase.OverrideInit(), Val(false); abstol, reltol)
247249
end
248250

249251
abstol = 1e-10

test/initialization.jl

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,9 +162,11 @@ end
162162
@test SciMLBase.initialization_status(prob) == SciMLBase.FULLY_DETERMINED
163163
integ = init(prob; initializealg = NoInit())
164164

165-
@testset "Errors without `nlsolve_alg`" begin
166-
@test_throws SciMLBase.OverrideInitMissingAlgorithm SciMLBase.get_initial_values(
167-
prob, integ, fn, SciMLBase.OverrideInit(), Val(false))
165+
@testset "Works without `nlsolve_alg`" begin
166+
abstol = 1e-10
167+
reltol = 1e-10
168+
SciMLBase.get_initial_values(
169+
prob, integ, fn, SciMLBase.OverrideInit(), Val(false); abstol, reltol)
168170
end
169171

170172
abstol = 1e-10

0 commit comments

Comments
 (0)