Skip to content

Commit

Permalink
more test fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
isaacsas committed Feb 26, 2025
1 parent 3f1f19f commit 80540fe
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/reactionsystem_conversions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -715,8 +715,8 @@ function DiffEqBase.ODEProblem(rs::ReactionSystem, u0, tspan,
# Handles potential differential algebraic equations (which requires `structural_simplify`).
if structural_simplify
(osys = MT.structural_simplify(osys))
elseif has_alg_equations(rs)
error("The input ReactionSystem has algebraic equations. This requires setting `structural_simplify=true` within `ODEProblem` call.")
# elseif has_alg_equations(rs)
# error("The input ReactionSystem has algebraic equations. This requires setting `structural_simplify=true` within `ODEProblem` call.")
else
osys = complete(osys)
end
Expand Down
12 changes: 8 additions & 4 deletions test/reactionsystem_core/coupled_equation_crn_systems.jl
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ let
@test issetequal(equations(coupled_rs)[3:3], eqs[3:3])

# Set simulation inputs.
u0 = [X => 0.1, A => 10.0]
u0 = [X => 0.1]
tspan = (0.0, 1000.0)
ps = [p => 1.0, d => 0.5, a => 2.0, b => 16.0]

Expand All @@ -158,17 +158,21 @@ let
@test_throws Exception SteadyStateProblem(coupled_rs, u0, ps)

# Checks that the correct steady state is found through ODEProblem.
oprob = ODEProblem(coupled_rs, u0, tspan, ps; structural_simplify = true)
oprob = ODEProblem(coupled_rs, u0, tspan, ps; structural_simplify = true,
guesses = [A => 1.0])
osol = solve(oprob, Rosenbrock23(); abstol = 1e-8, reltol = 1e-8)
@test osol.u[end] [2.0, 3.0]

# Checks that the correct steady state is found through NonlinearProblem.
nlprob = NonlinearProblem(coupled_rs, u0, ps)
u0 = [X => 0.1, A => 16.1/2]
nlprob = NonlinearProblem(coupled_rs, u0, ps, structural_simplify = true)
nlsol = solve(nlprob)
@test nlsol [2.0, 3.0]

# Checks that the correct steady state is found through SteadyStateProblem.
ssprob = SteadyStateProblem(coupled_rs, u0, ps; structural_simplify = true)
u0 = [X => 0.1]
ssprob = SteadyStateProblem(coupled_rs, u0, ps; structural_simplify = true,
guesses = [A => 1.0])
sssol = solve(ssprob, DynamicSS(Rosenbrock23()); abstol = 1e-8, reltol = 1e-8)
@test sssol [2.0, 3.0]
end
Expand Down

0 comments on commit 80540fe

Please sign in to comment.