diff --git a/test/compositional_modelling/component_based_model_creation.jl b/test/compositional_modelling/component_based_model_creation.jl index f3f5ae01b7..94852cd4cc 100644 --- a/test/compositional_modelling/component_based_model_creation.jl +++ b/test/compositional_modelling/component_based_model_creation.jl @@ -46,8 +46,8 @@ let sys₂.μ => (log(2) / 600), sys₃.α₀ => 5e-4, sys₃.α => 0.5, sys₃.K => 40.0, sys₃.n => 2, sys₃.δ => (log(2) / 120), sys₃.β => (20 * log(2) / 120), sys₃.μ => (log(2) / 600)] - u₀ = [sys₁.m => 0.0, sys₁.P => 20.0, sys₁.R => 0.0, sys₂.m => 0.0, sys₂.P => 0.0, - sys₂.R => 0.0, sys₃.m => 0.0, sys₃.P => 0.0, sys₃.R => 0.0] + u₀ = [sys₁.m => 0.0, sys₁.P => 20.0, sys₂.m => 0.0, sys₂.P => 0.0, + sys₃.m => 0.0, sys₃.P => 0.0] tspan = (0.0, 100000.0) oprob = ODEProblem(oderepressilator, u₀, tspan, pvals) sol = solve(oprob, Tsit5()) @@ -94,13 +94,15 @@ let @test all(isapprox.(sol(tvs, idxs = sys₁.P), sol2(tvs, idxs = 4), atol = 1e-4)) # Test conversion to nonlinear system. + u₀_nl = [sys₁.m => 0.0, sys₁.P => 20.0, sys₁.R => 0.0, sys₂.m => 0.0, sys₂.P => 0.0, + sys₂.R => 0.0, sys₃.m => 0.0, sys₃.P => 0.0, sys₃.R => 0.0] @named nsys = NonlinearSystem(connections, [], []) @named ssrepressilator = ReactionSystem(t; systems = [nsys, sys₁, sys₂, sys₃]) ssrepressilator = complete(ssrepressilator) @named nlrepressilator = convert(NonlinearSystem, ssrepressilator, include_zero_odes = false) sys2 = structural_simplify(nlrepressilator) @test length(equations(sys2)) <= 6 - nlprob = NonlinearProblem(sys2, u₀, pvals) + nlprob = NonlinearProblem(sys2, u₀_nl, pvals) sol = solve(nlprob, NLSolveJL(), abstol = 1e-9) @test sol[sys₁.P] ≈ sol[sys₂.P] ≈ sol[sys₃.P] @test sol[sys₁.m] ≈ sol[sys₂.m] atol=1e-7 @@ -113,7 +115,7 @@ let @named nlrepressilator = convert(NonlinearSystem, fsys, include_zero_odes = false) sys2 = structural_simplify(nlrepressilator) @test length(equations(sys2)) <= 6 - nlprob = NonlinearProblem(sys2, u₀, pvals) + nlprob = NonlinearProblem(sys2, u₀_nl, pvals) sol = solve(nlprob, NLSolveJL(), abstol = 1e-9) @test sol[sys₁.P] ≈ sol[sys₂.P] ≈ sol[sys₃.P] @test sol[sys₁.m] ≈ sol[sys₂.m] atol=1e-7 @@ -131,7 +133,7 @@ let @named nlrepressilator = convert(NonlinearSystem, repressilator2, include_zero_odes = false) sys2 = structural_simplify(nlrepressilator) @test length(equations(sys2)) <= 6 - nlprob = NonlinearProblem(sys2, u₀, pvals) + nlprob = NonlinearProblem(sys2, u₀_nl, pvals) sol = solve(nlprob, NLSolveJL(), abstol = 1e-9) @test sol[sys₁.P] ≈ sol[sys₂.P] ≈ sol[sys₃.P] @test sol[sys₁.m] ≈ sol[sys₂.m] atol=1e-7 @@ -252,7 +254,7 @@ let @named nlrepressilator = convert(NonlinearSystem, repressilator2, include_zero_odes = false) sys2 = structural_simplify(nlrepressilator) @test length(equations(sys2)) <= 6 - nlprob = NonlinearProblem(sys2, u₀, pvals) + nlprob = NonlinearProblem(sys2, u₀_nl, pvals) sol = solve(nlprob, NLSolveJL(), abstol = 1e-9) @test sol[sys₁.P] ≈ sol[sys₂.P] ≈ sol[sys₃.P] @test sol[sys₁.m] ≈ sol[sys₂.m] atol=1e-7 diff --git a/test/dsl/dsl_options.jl b/test/dsl/dsl_options.jl index b92a9bf0e2..04247d0778 100644 --- a/test/dsl/dsl_options.jl +++ b/test/dsl/dsl_options.jl @@ -784,7 +784,7 @@ let @test isequal(equations(rn)[4], 3Y + X ~ S + X*d) # Checks that simulations has the correct output - u0 = Dict([S => 1 + rand(rng), X => 1 + rand(rng), Y => 1 + rand(rng)]) + u0 = Dict([S => 1 + rand(rng)]) ps = Dict([p => 1 + rand(rng), d => 1 + rand(rng), k => 1 + rand(rng)]) oprob = ODEProblem(rn, u0, (0.0, 10000.0), ps; structural_simplify=true) sol = solve(oprob, Tsit5(); abstol=1e-9, reltol=1e-9) @@ -895,7 +895,7 @@ let @test equations(rn)[3] isa Equation # Checks that simulations has the correct output - u0 = Dict([S => 1 + rand(rng), X => 1 + rand(rng), Y => 1 + rand(rng)]) + u0 = Dict([S => 1 + rand(rng), Y => 1 + rand(rng)]) ps = Dict([p => 1 + rand(rng), d => 1 + rand(rng), k => 1 + rand(rng)]) oprob = ODEProblem(rn, u0, (0.0, 10000.0), ps; structural_simplify=true) sol = solve(oprob, Tsit5(); abstol=1e-9, reltol=1e-9) @@ -1025,4 +1025,3 @@ let @parameters v n @test isequal(Catalyst.expand_registered_functions(equations(rn4)[1]), D(A) ~ v*(A^n)) end - diff --git a/test/miscellaneous_tests/reactionsystem_serialisation.jl b/test/miscellaneous_tests/reactionsystem_serialisation.jl index 61a4637485..8b84c2b420 100644 --- a/test/miscellaneous_tests/reactionsystem_serialisation.jl +++ b/test/miscellaneous_tests/reactionsystem_serialisation.jl @@ -513,6 +513,7 @@ let d, X --> 0, [misc = x -> 2x] end @test_throws Exception save_reactionsystem("test_serialisation.jl", rs) + rm("test_serialisation.jl") end # Test connection field.