Skip to content

Commit f9c0911

Browse files
test: update tests with new SCCNonlinearProblem
1 parent dff5a38 commit f9c0911

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

test/scc_nonlinear_problem.jl

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,9 @@ end
9696
@mtkcompile sys = System(eqs, [u], [p1, p2])
9797
sccprob = SCCNonlinearProblem(sys, [u => u0, p1 => p[1], p2 => p[2][]])
9898
sccsol = solve(sccprob, SimpleNewtonRaphson(); abstol = 1e-9)
99+
sccresid = prob.f(sccsol[u], (u0, p))
99100
@test SciMLBase.successful_retcode(sccsol)
100-
@test norm(sccsol.resid) < norm(sol.resid)
101+
@test norm(sccresid) < norm(sol.resid)
101102

102103
# Test BLT sorted
103104
@test istril(StructuralTransformations.sorted_incidence_matrix(sys), 1)
@@ -178,9 +179,11 @@ end
178179
0 ~ func(x[1], x[2]) * exp(x[3]) - x[4]^3 - 5
179180
0 ~ func(x[1], x[2]) * exp(x[4]) - x[3]^3 - 4])
180181
sccprob = SCCNonlinearProblem(sys, [])
182+
# since explicitfuns are called during problem construction
183+
@test val[] == 1
181184
sccsol = solve(sccprob, NewtonRaphson())
182185
@test SciMLBase.successful_retcode(sccsol)
183-
@test val[] == 1
186+
@test val[] == 2
184187
end
185188

186189
import ModelingToolkitStandardLibrary.Blocks as B

0 commit comments

Comments
 (0)