Skip to content

Commit

Permalink
test: fix mass matrix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
AayushSabharwal committed Feb 20, 2024
1 parent 406338c commit a84ee9c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions test/mass_matrix.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ eqs = [D(y[1]) ~ -k[1] * y[1] + k[3] * y[2] * y[3],
D(y[2]) ~ k[1] * y[1] - k[3] * y[2] * y[3] - k[2] * y[2]^2,
0 ~ y[1] + y[2] + y[3] - 1]

@named sys = ODESystem(eqs, t, y, [k])
@named sys = ODESystem(eqs, t, collect(y), [k])
sys = complete(sys)
@test_throws ArgumentError ODESystem(eqs, y[1])
M = calculate_massmatrix(sys)
@test M == [1 0 0
0 1 0
0 0 0]

prob_mm = ODEProblem(sys, [1.0, 0.0, 0.0], (0.0, 1e5),
prob_mm = ODEProblem(sys, [y => [1.0, 0.0, 0.0]], (0.0, 1e5),
[k => [0.04, 3e7, 1e4]])
sol = solve(prob_mm, Rodas5(), reltol = 1e-8, abstol = 1e-8)

Expand All @@ -40,6 +40,6 @@ sol2 = solve(prob_mm2, Rodas5(), reltol = 1e-8, abstol = 1e-8, tstops = sol.t,
# Test mass matrix in the identity case
eqs = [D(y[1]) ~ y[1], D(y[2]) ~ y[2], D(y[3]) ~ y[3]]

@named sys = ODESystem(eqs, t, y, k)
@named sys = ODESystem(eqs, t, collect(y), [k])

@test calculate_massmatrix(sys) === I

0 comments on commit a84ee9c

Please sign in to comment.