Ordering of unknowns(system) in MTK when array-valued variables are scalarized via structural_simplify

What is the current rule for ordering of array-valued variables once structural_simplify has been called and sort_eqs is set to false? My current array has something like this:

unknowns(sys)[221:230]

 (Φ_s_c(t))[2]
 (Φ_s_c(t))[1]
 (Φ_s_c(t))[3]
 (Φ_s_c(t))[4]
 (Φ_s_c(t))[5]
 (Φ_s_c(t))[6]
 (Φ_s_c(t))[7]
 (Φ_s_c(t))[8]
 (Φ_s_c(t))[9]
 (Φ_s_c(t))[10]

but I’d like to swap the first two. Is this possible? Would this be based off of which variable I reference first when constructing the equations?

Ordering of symbols is not guaranteed after symbolic transformations, and parameters are now stored in a custom MTKParameters object instead of a vector.
Frequently Asked Questions · ModelingToolkit.jl

So no, you cannot swap ordering, and you don’t need to swap the order if you use symbolic indexing, for example sol[sys.Φ_s_c[2]].

Thanks Bart, I was curious because I am trying to visualize the full system’s Jacobian which contains equations with Laplacian of Φ_s_c. This ordering leads to some odd-looking parts at the switched variables.

The function ModelingToolkit.calculate_jacobian does have a kwarg dvs=unknowns(sys) but I am not sure if passing differential vars with a different ordering will affect the ordering in the calculated jacobian, you could try this.