diff --git a/docs/src/tutorials/initialization.md b/docs/src/tutorials/initialization.md index 4886a47a73..136f671281 100644 --- a/docs/src/tutorials/initialization.md +++ b/docs/src/tutorials/initialization.md @@ -195,7 +195,7 @@ long enough you will see that `λ = 0` is required for this equation, but since `λ = 1` we end up with a set of equations that are impossible to satisfy. !!! note - + If you would prefer to have an error instead of a warning in the context of non-fully determined systems, pass the keyword argument `fully_determined = true` into the problem constructor. Additionally, any warning about not being fully determined can @@ -278,7 +278,7 @@ sol = solve(iprob) ``` !!! note - + For more information on solving NonlinearProblems and NonlinearLeastSquaresProblems, check out the [NonlinearSolve.jl tutorials!](https://docs.sciml.ai/NonlinearSolve/stable/tutorials/getting_started/). diff --git a/test/initializationsystem.jl b/test/initializationsystem.jl index 5111381121..1d1ae9bf77 100644 --- a/test/initializationsystem.jl +++ b/test/initializationsystem.jl @@ -17,7 +17,8 @@ sol = solve(initprob) @test SciMLBase.successful_retcode(sol) @test maximum(abs.(sol[conditions])) < 1e-14 -@test_throws ModelingToolkit.ExtraVariablesSystemException ModelingToolkit.InitializationProblem(pend, 0.0, [], [g => 1]; +@test_throws ModelingToolkit.ExtraVariablesSystemException ModelingToolkit.InitializationProblem( + pend, 0.0, [], [g => 1]; guesses = [ModelingToolkit.missing_variable_defaults(pend); x => 1; y => 0.2], fully_determined = true) @@ -55,7 +56,8 @@ sol = solve(prob.f.initializeprob) sol = solve(prob, Rodas5P()) @test maximum(abs.(sol[conditions][1])) < 1e-14 -@test_throws ModelingToolkit.ExtraVariablesSystemException ODEProblem(pend, [x => 1], (0.0, 1.5), [g => 1], +@test_throws ModelingToolkit.ExtraVariablesSystemException ODEProblem( + pend, [x => 1], (0.0, 1.5), [g => 1], guesses = ModelingToolkit.missing_variable_defaults(pend), fully_determined = true) @@ -237,7 +239,8 @@ initsol = solve(initprob, reltol = 1e-12, abstol = 1e-12) @test SciMLBase.successful_retcode(initsol) @test maximum(abs.(initsol[conditions])) < 1e-14 -@test_throws ModelingToolkit.ExtraEquationsSystemException ModelingToolkit.InitializationProblem(sys, 0.0, fully_determined = true) +@test_throws ModelingToolkit.ExtraEquationsSystemException ModelingToolkit.InitializationProblem( + sys, 0.0, fully_determined = true) allinit = unknowns(sys) .=> initsol[unknowns(sys)] prob = ODEProblem(sys, allinit, (0, 0.1)) @@ -249,7 +252,8 @@ sol = solve(prob, Rodas5P(), initializealg = BrownFullBasicInit()) prob = ODEProblem(sys, allinit, (0, 0.1)) prob = ODEProblem(sys, [], (0, 0.1), check = false) -@test_throws ModelingToolkit.ExtraEquationsSystemException ODEProblem(sys, [], (0, 0.1), fully_determined = true) +@test_throws ModelingToolkit.ExtraEquationsSystemException ODEProblem( + sys, [], (0, 0.1), fully_determined = true) sol = solve(prob, Rodas5P()) # If initialized incorrectly, then it would be InitialFailure