| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
…e solving
NLsolve.jl's trust region dogleg solver is replaced by NonlinearSolve.jl's
TrustRegion() in both KPS3 and KPS4 find_steady_state! functions. This
removes NLsolve and NLSolversBase as direct dependencies while NonlinearSolve
was already a transitive dependency via OrdinaryDiffEqNonlinearSolve.
The custom finite-difference Jacobian (make_jac) is retained because the
model's MVector{3, Float64} internals cannot hold ForwardDiff.Dual numbers.
NLsolve's autoscale=true is not needed — TrustRegion works without it and
actually produces slightly better results on the l=392 test case.
All 452 tests pass (441 pass + 11 pre-existing broken).
Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
|
This branch is not passing the tests: julia> include("test/test-steady-state-kps4.jl")
Activating project at `~/repos/KiteModels.jl/test`
┌ Warning: find_steady_state!: solver did not converge! retcode=Stalled
└ @ KiteModels ~/repos/KiteModels.jl/src/KPS4.jl:704
test_find_steady_state: Test Failed at /home/ufechner/repos/KiteModels.jl/test/test-steady-state-kps4.jl:42
Expression: pre_tension > 1.0001
Evaluated: 1.0 > 1.0001
Stacktrace:
[1] macro expansion
@ ~/.julia/juliaup/julia-1.11.9+0.x64.linux.gnu/share/julia/stdlib/v1.11/Test/src/Test.jl:680 [inlined]
[2] macro expansion
@ ~/repos/KiteModels.jl/test/test-steady-state-kps4.jl:42 [inlined]
[3] macro expansion
@ ~/.julia/juliaup/julia-1.11.9+0.x64.linux.gnu/share/julia/stdlib/v1.11/Test/src/Test.jl:1709 [inlined]
[4] top-level scope
@ ~/repos/KiteModels.jl/test/test-steady-state-kps4.jl:30
┌ Warning: find_steady_state!: solver did not converge! retcode=MaxIters
└ @ KiteModels ~/repos/KiteModels.jl/src/KPS4.jl:704
test_find_steady_state: Test Failed at /home/ufechner/repos/KiteModels.jl/test/test-steady-state-kps4.jl:42
Expression: pre_tension > 1.0001
Evaluated: 1.0 > 1.0001
Stacktrace:
[1] macro expansion
@ ~/.julia/juliaup/julia-1.11.9+0.x64.linux.gnu/share/julia/stdlib/v1.11/Test/src/Test.jl:680 [inlined]
[2] macro expansion
@ ~/repos/KiteModels.jl/test/test-steady-state-kps4.jl:42 [inlined]
[3] macro expansion
@ ~/.julia/juliaup/julia-1.11.9+0.x64.linux.gnu/share/julia/stdlib/v1.11/Test/src/Test.jl:1709 [inlined]
[4] top-level scope
@ ~/repos/KiteModels.jl/test/test-steady-state-kps4.jl:30
test_find_steady_state: Test Failed at /home/ufechner/repos/KiteModels.jl/test/test-steady-state-kps4.jl:45
Expression: isapprox(tether_length(kps4_local), 1.008954l, rtol = 0.01)
Evaluated: isapprox(197.42057783848486, 201.7908; rtol = 0.01)
Stacktrace:
[1] macro expansion
@ ~/.julia/juliaup/julia-1.11.9+0.x64.linux.gnu/share/julia/stdlib/v1.11/Test/src/Test.jl:680 [inlined]
[2] macro expansion
@ ~/repos/KiteModels.jl/test/test-steady-state-kps4.jl:45 [inlined]
[3] macro expansion
@ ~/.julia/juliaup/julia-1.11.9+0.x64.linux.gnu/share/julia/stdlib/v1.11/Test/src/Test.jl:1709 [inlined]
[4] top-level scope
@ ~/repos/KiteModels.jl/test/test-steady-state-kps4.jl:30
┌ Warning: find_steady_state!: solver did not converge! retcode=MaxIters
└ @ KiteModels ~/repos/KiteModels.jl/src/KPS4.jl:704
test_find_steady_state: Test Failed at /home/ufechner/repos/KiteModels.jl/test/test-steady-state-kps4.jl:42
Expression: pre_tension > 1.0001
Evaluated: 1.0 > 1.0001
Stacktrace:
[1] macro expansion
@ ~/.julia/juliaup/julia-1.11.9+0.x64.linux.gnu/share/julia/stdlib/v1.11/Test/src/Test.jl:680 [inlined]
[2] macro expansion
@ ~/repos/KiteModels.jl/test/test-steady-state-kps4.jl:42 [inlined]
[3] macro expansion
@ ~/.julia/juliaup/julia-1.11.9+0.x64.linux.gnu/share/julia/stdlib/v1.11/Test/src/Test.jl:1709 [inlined]
[4] top-level scope
@ ~/repos/KiteModels.jl/test/test-steady-state-kps4.jl:30
test_find_steady_state: Test Failed at /home/ufechner/repos/KiteModels.jl/test/test-steady-state-kps4.jl:45
Expression: isapprox(tether_length(kps4_local), 1.008954l, rtol = 0.01)
Evaluated: isapprox(389.9800737647081, 395.50996799999996; rtol = 0.01)
Stacktrace:
[1] macro expansion
@ ~/.julia/juliaup/julia-1.11.9+0.x64.linux.gnu/share/julia/stdlib/v1.11/Test/src/Test.jl:680 [inlined]
[2] macro expansion
@ ~/repos/KiteModels.jl/test/test-steady-state-kps4.jl:45 [inlined]
[3] macro expansion
@ ~/.julia/juliaup/julia-1.11.9+0.x64.linux.gnu/share/julia/stdlib/v1.11/Test/src/Test.jl:1709 [inlined]
[4] top-level scope
@ ~/repos/KiteModels.jl/test/test-steady-state-kps4.jl:30
Test Summary: | Pass Fail Total Time
test_find_steady_state | 10 5 15 1.6s
ERROR: LoadError: Some tests did not pass: 10 passed, 5 failed, 0 errored, 0 broken.
in expression starting at /home/ufechner/repos/KiteModels.jl/test/test-steady-state-kps4.jl:29
|
Sorry, something went wrong.
|
v1.12 is fine but v1.11 is not. Peculiar. |
Sorry, something went wrong.
|
now that the linear solve issue is fixed we should rerun tests |
Sorry, something went wrong.
|
Retested locally on Julia 1.11.9 with LinearSolve.jl v3.59.1 (which includes the fix from LinearSolve.jl#888). All tests pass: Julia 1.11.9 LinearSolve v3.59.1 NonlinearSolve v4.16.0 Test Summary: | Pass Broken Total Time Testing KiteModels... | 441 11 452 1m22.0s Aqua | 9 9 27.5s Helpers | 19 19 1.3s Inertia Calculation | 24 24 2.4s Interface | 14 14 0.7s Kps3 Fails | 4 4 1.0s Kps3 | 67 67 5.6s Kps4 | 200 11 211 17.6s Orientation | 81 81 1.0s Staticarrays | 1 1 3.2s Steady State Kps4 | 15 15 0.4s KPS3 benchmarking.... | 2 2 4.1s KPS4 benchmarking... | 5 5 16.7s The root cause on 1.11 was LinearSolve.jl#887: MKLLUFactorization does in-place getrf! which corrupts cache.A with L\U factors. When LU fails on singular/rank-deficient Jacobians, DefaultLinearSolver's QR safety fallback got the corrupted matrix instead of the original, producing garbage Newton steps. This only affected Julia 1.11 (where MKL_jll loads) — on 1.12 MKL_jll doesn't load so the regular LUFactorization was used, which allocates a new object and leaves cache.A intact. The fix in LinearSolve.jl#888 stores a backup of the original matrix and restores it before the QR fallback. With LinearSolve v3.59.1 this PR's KPS4 steady-state tests all converge correctly on Julia 1.11. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Summary
Motivation
NLsolve.jl has known issues with subnormal Jacobian entries from NLSolversBase >= 7.10 (see PR #259). Rather than pinning NLSolversBase or maintaining workarounds, this PR switches to NonlinearSolve.jl which:
Changes
Test plan
Related
🤖 Generated with Claude Code