Skip to content

Commit 9df0b4b

Browse files
remove old initialize
1 parent 2efc30a commit 9df0b4b

File tree

1 file changed

+0
-43
lines changed

1 file changed

+0
-43
lines changed

test/nonlinearsystem.jl

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -242,46 +242,3 @@ testdict = Dict([:test => 1])
242242
@test prob_.u0 == [1.0, 2.0, 1.0]
243243
@test prob_.p == MTKParameters(sys, [a => 2.0, b => 1.0, c => 1.0])
244244
end
245-
246-
@testset "Initialization System" begin
247-
# Define the Lotka Volterra system which begins at steady state
248-
@parameters t
249-
pars = @parameters a=1.5 b=1.0 c=3.0 d=1.0 dx_ss=1e-5
250-
251-
vars = @variables begin
252-
dx(t),
253-
dy(t),
254-
(x(t) = dx ~ dx_ss), [guess = 0.5]
255-
(y(t) = dy ~ 0), [guess = -0.5]
256-
end
257-
258-
D = Differential(t)
259-
260-
eqs = [dx ~ a * x - b * x * y
261-
dy ~ -c * y + d * x * y
262-
D(x) ~ dx
263-
D(y) ~ dy]
264-
265-
@named sys = ODESystem(eqs, t, vars, pars)
266-
267-
sys_simple = structural_simplify(sys)
268-
269-
# Set up the initialization system
270-
sys_init = initializesystem(sys_simple)
271-
272-
sys_init_simple = structural_simplify(sys_init)
273-
274-
prob = NonlinearProblem(sys_init_simple,
275-
get_default_or_guess.(unknowns(sys_init_simple)))
276-
277-
@test prob.u0 == [0.5, -0.5]
278-
279-
sol = solve(prob)
280-
@test sol.retcode == SciMLBase.ReturnCode.Success
281-
282-
# Confirm for all the unknowns of the non-simplified system
283-
@test all(.≈(sol[unknowns(sys)], [1e-5, 0, 1e-5 / 1.5, 0]; atol = 1e-8))
284-
285-
# Confirm for all the unknowns of the simplified system
286-
@test all(.≈(sol[unknowns(sys_simple)], [1e-5 / 1.5, 0]; atol = 1e-8))
287-
end

0 commit comments

Comments
 (0)