Skip to content

Commit 5c130fb

Browse files
committed
Fix test
1 parent dec1893 commit 5c130fb

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

test/structural_transformation/tearing.jl

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ using Test
22
using ModelingToolkit
33
using ModelingToolkit: Equation
44
using ModelingToolkit.StructuralTransformations: SystemStructure, find_solvables!
5-
using NLsolve
5+
using NonlinearSolve
66
using LinearAlgebra
77
using UnPack
88

@@ -114,14 +114,9 @@ S = StructuralTransformations.reordered_matrix(sys, partitions)
114114
# 0 = u5 - hypot(sin(u5), hypot(cos(sin(u5)), hypot(sin(u5), cos(sin(u5)))))
115115
tornsys = tearing(sys)
116116
@test isequal(equations(tornsys), [0 ~ u5 + (-1 * hypot(hypot(cos(sin(u5)), hypot(sin(u5), cos(sin(u5)))), sin(u5)))])
117-
nlsys_func = generate_function(tornsys)[2]
118-
f = eval(nlsys_func)
119-
du = zeros(1)
120-
u = ones(1)
121-
p = nothing
122-
sol = nlsolve((out, x) -> f(out, x, p), u)
123-
f(du, sol.zero, p)
124-
@test norm(du) < 1e-10
117+
prob = NonlinearProblem(tornsys, ones(1))
118+
sol = solve(prob, NewtonRaphson())
119+
@test norm(prob.f(sol.u, sol.prob.p)) < 1e-10
125120

126121
###
127122
### Simple test (edge case)

0 commit comments

Comments
 (0)