Skip to content

Commit f4deb3a

Browse files
committed
updates with working conservation laws
1 parent 4832dfe commit f4deb3a

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ HomotopyContinuation = "2.9"
4444
LaTeXStrings = "1.3.0"
4545
Latexify = "0.14, 0.15, 0.16"
4646
MacroTools = "0.5.5"
47-
ModelingToolkit = "9.6"
47+
ModelingToolkit = "9.7.1"
4848
Parameters = "0.12"
4949
Reexport = "0.2, 1.0"
5050
Requires = "1.0"

test/extensions/homotopy_continuation.jl

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ include("../test_functions.jl")
1414
# Tests for Symbolics initial condition input.
1515
# Tests for different types (Symbol/Symbolics) for parameters and initial conditions.
1616
# Tests that attempts to find steady states of system with conservation laws, while u0 is not provided, gives an error.
17-
@test_broken let # Requires https://github.com/SciML/ModelingToolkit.jl/issues/2566 to be fixed
17+
let
18+
# Creates the model.
1819
rs = @reaction_network begin
1920
(k1,k2), X1 <--> X2
2021
(k3,k4), 2X2 + X3 <--> X2_2X3
@@ -23,10 +24,12 @@ include("../test_functions.jl")
2324
ps = [k1 => 1.0, k2 => 2.0, k3 => 2.0, k4 => 2.0]
2425
u0 = [:X1 => 2.0, :X2 => 2.0, :X3 => 2.0, :X2_2X3 => 2.0]
2526

26-
hc_ss = hc_steady_states(rs, ps; u0=u0, show_progress=false)[1]
27-
f = ODEFunction(convert(ODESystem, rs))
28-
@test f(hc_ss, last.(ps), 0.0)[1] == 0.0
27+
# Computes the single steady state, checks that when given to the ODE rhs, all are evaluated to 0.
28+
hc_ss = hc_steady_states(rs, ps; u0=u0, show_progress=false)
29+
hc_ss = Pair.(unknowns(rs), hc_ss[1])
30+
@test maximum(abs.(f_eval(rs, hc_ss, ps, 0.0))) 0.0 atol=1e-12
2931

32+
# Checks that not giving a `u0` argument yields an error for systems with conservation laws.
3033
@test_throws Exception hc_steady_states(rs, ps; show_progress=false)
3134
end
3235

@@ -55,7 +58,7 @@ end
5558
# Tests correctness in presence of default values.
5659
# Tests where some default values are overwritten with other values.
5760
# Tests where input ps/u0 are tuples with mixed types.
58-
@test_broken let # Requires https://github.com/SciML/ModelingToolkit.jl/issues/2566 to be fixed
61+
let
5962
rs_1 = @reaction_network begin
6063
@parameters kX1=1.0 kX2=2.0 kY1=12345.0
6164
@species X1(t)=0.1 X2(t)=0.2 Y1(t)=12345.0

test/miscellaneous_tests/api.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -533,7 +533,6 @@ end
533533
# Test conservation law elimination.
534534
# Conservation laws currently broken (you get stuck in an infinite loop in MTK or something).
535535
let
536-
return (@test_broken false)
537536
rn = @reaction_network begin
538537
(k1, k2), A + B <--> C
539538
(m1, m2), D <--> E

test/miscellaneous_tests/nonlinear_solve.jl

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,6 @@ end
7777
# Checks for system with conservation laws.
7878
# Checks using interfacing with output solution.
7979
let
80-
# Conservation laws currently broken (you get stuck in an infinite loop in MTK or something).
81-
return (@test_broken false)
8280
# Creates steady state network, unpack the parameter values.
8381
steady_state_network_3 = @reaction_network begin
8482
(p,d), 0 <--> X
@@ -98,6 +96,6 @@ let
9896
sol2 = solve(nl_prob_2, DynamicSS(Rosenbrock23()); abstol=1e-12, reltol=1e-12)
9997

10098
# Checks output using the ODE's drift function
101-
@test f_eval([:X => sol1[X], :Y => sol1[Y], :Y2 => sol1[Y2], :XY2 => sol1[XY2]], p, 0.0) [0.0, 0.0, 0.0, 0.0] atol=1e-10
102-
@test f_eval([:X => sol2[X], :Y => sol2[Y], :Y2 => sol2[Y2], :XY2 => sol2[XY2]], p, 0.0) [0.0, 0.0, 0.0, 0.0] atol=1e-10
99+
@test f_eval(steady_state_network_3, [:X => sol1[X], :Y => sol1[Y], :Y2 => sol1[Y2], :XY2 => sol1[XY2]], p, 0.0) [0.0, 0.0, 0.0, 0.0] atol=1e-10
100+
@test f_eval(steady_state_network_3, [:X => sol2[X], :Y => sol2[Y], :Y2 => sol2[Y2], :XY2 => sol2[XY2]], p, 0.0) [0.0, 0.0, 0.0, 0.0] atol=1e-10
103101
end

0 commit comments

Comments
 (0)