Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion test/downstream/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Tracker = "9f7883ad-71c0-57eb-9f7f-b5c9e6d3789c"
Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d"

[compat]
ModelingToolkit = "8.33, 9"
ModelingToolkit = "10"
MonteCarloMeasurements = "1.1"
OrdinaryDiffEq = "6.31"
StaticArrays = "1"
Expand Down
12 changes: 5 additions & 7 deletions test/downstream/symbol_indexing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@ include("../testutils.jl")
@variables x(t)
@parameters τ
@variables RHS(t)
@mtkbuild fol_separate = ODESystem([RHS ~ (1 - x) / τ,
D(x) ~ RHS], t)
@mtkcompile fol_separate = System([RHS ~ (1 - x) / τ, D(x) ~ RHS], t)

prob = ODEProblem(fol_separate, [x => 0.0], (0.0, 10.0), [τ => 3.0])
prob = ODEProblem(fol_separate, [x => 0.0, τ => 3.0], (0.0, 10.0))
sol = solve(prob, Tsit5())

sol_new = DiffEqArray(sol.u[1:10],
Expand Down Expand Up @@ -50,11 +49,10 @@ test_tables_interface(sol_new, [:timestamp, Symbol("x(t)")], hcat(sol_new[t], so
# Two components
@variables y(t)
@parameters α β γ δ
@mtkbuild lv = ODESystem([D(x) ~ α * x - β * x * y,
@mtkcompile lv = System([D(x) ~ α * x - β * x * y,
D(y) ~ δ * x * y - γ * x * y], t)

prob = ODEProblem(lv, [x => 1.0, y => 1.0], (0.0, 10.0),
[α => 1.5, β => 1.0, γ => 3.0, δ => 1.0])
prob = ODEProblem(lv, [x => 1.0, y => 1.0, α => 1.5, β => 1.0, γ => 3.0, δ => 1.0], (0.0, 10.0))
sol = solve(prob, Tsit5())

ts = 0:0.5:10
Expand All @@ -69,7 +67,7 @@ sts = @variables x(t)[1:3]=[1, 2, 3.0] y(t)=1.0
ps = @parameters p[1:3] = [1, 2, 3]
eqs = [collect(D.(x) .~ x)
D(y) ~ norm(collect(x)) * y - x[1]]
@mtkbuild sys = ODESystem(eqs, t, sts, ps)
@mtkcompile sys = ODESystem(eqs, t, sts, ps)
prob = ODEProblem(sys, [], (0, 1.0))
sol = solve(prob, Tsit5())
@test sol[x .+ [y, 2y, 3y]] ≈ vcat.(getindex.((sol,), [x[1] + y, x[2] + 2y, x[3] + 3y])...)
Expand Down
Loading