-
-
Notifications
You must be signed in to change notification settings - Fork 233
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug 🐞
MTK will lexographically sort equations whether or not the sort_eqs kwarg is provided to mtkcompile.
Expected behavior
A clear and concise description of what you expected to happen.
Minimal Reproducible Example 👇
using ModelingToolkit
using ModelingToolkit: t_nounits as t, D_nounits as DWith sorting enabled:
julia> let sort_eqs=true
@variables x(t) y(t) z(t)
eqs = [
D(x) ~ y
D(z) ~ x
D(y) ~ z
]
@named sys = System(eqs, t)
sys_comp = mtkcompile(sys; sort_eqs)
equations(sys_comp)
end
3-element Vector{Equation}:
Differential(t)(y(t)) ~ z(t)
Differential(t)(z(t)) ~ x(t)
Differential(t)(x(t)) ~ y(t)With sorting 'disabled'
julia> let sort_eqs=false
@variables x(t) y(t) z(t)
eqs = [
D(x) ~ y
D(z) ~ x
D(y) ~ z
]
@named sys = System(eqs, t)
sys_comp = mtkcompile(sys; sort_eqs)
equations(sys_comp)
end
3-element Vector{Equation}:
Differential(t)(y(t)) ~ z(t)
Differential(t)(z(t)) ~ x(t)
Differential(t)(x(t)) ~ y(t)Note that there is no difference.
Environment (please complete the following information):
- Output of
using Pkg; Pkg.status()
(jl_kKdqv9) pkg> st
Status `/tmp/jl_kKdqv9/Project.toml`
[961ee093] ModelingToolkit v10.26.0
[789caeaf] StochasticDiffEq v6.83.0Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working