Skip to content

Commit b669cc9

Browse files
committed
Test vector in initial conditions
1 parent a61977a commit b669cc9

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

test/initializationsystem.jl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -567,3 +567,12 @@ oprob_2nd_order_2 = ODEProblem(sys_2nd_order, u0_2nd_order_2, tspan, ps)
567567
sol = solve(oprob_2nd_order_2, Rosenbrock23()) # retcode: Success
568568
@test sol[Y][1] == 2.0
569569
@test sol[D(Y)][1] == 0.5
570+
571+
@testset "Vector in initial conditions" begin
572+
@variables x(t)[1:5] y(t)[1:5]
573+
@named sys = ODESystem([D(x) ~ x, D(y) ~ y], t; initialization_eqs = [y ~ -x])
574+
sys = structural_simplify(sys)
575+
prob = ODEProblem(sys, [sys.x => ones(5)], (0.0, 1.0), [])
576+
sol = solve(prob, Tsit5(), reltol=1e-4)
577+
@test all(sol(1.0, idxs=sys.x) .≈ +exp(1)) && all(sol(1.0, idxs=sys.y) .≈ -exp(1))
578+
end

0 commit comments

Comments
 (0)