Skip to content

Commit c226497

Browse files
committed
Add more Jacobian tests
1 parent 2ec0999 commit c226497

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

test/odesystem.jl

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using ModelingToolkit, StaticArrays, LinearAlgebra
2+
using OrdinaryDiffEq
23
using DiffEqBase
34
using Test
45

@@ -209,6 +210,11 @@ p = [k₁ => 0.04,
209210
k₂ => 3e7,
210211
k₃ => 1e4]
211212
tspan = (0.0,100000.0)
212-
prob = ODEProblem(sys,u0,tspan,p)
213-
sol = solve(prob, Rodas5())
214-
@test all(x->sum(x) 1.0, sol.u)
213+
prob1 = ODEProblem(sys,u0,tspan,p)
214+
prob2 = ODEProblem(sys,u0,tspan,p,jac=true)
215+
# Wfact version is not very stable because of the lack of pivoting
216+
prob3 = ODEProblem(sys,u0,tspan,p,Wfact=true,Wfact_t=true)
217+
for (prob, atol) in [(prob1, 1e-12), (prob2, 1e-12), (prob3, 0.1)]
218+
sol = solve(prob, Rodas5())
219+
@test all(x->(sum(x), 1.0, atol=atol), sol.u)
220+
end

0 commit comments

Comments
 (0)