MethodOfLines creates a symbolic array variable indexed over discretized spaces.

After structurally simplifying the system (currently done automatically in the discretization) there are several corresponding variables in the ODE system, for which I want to update the initial state of the corresponding ODEProblem in an optimization.

I know that I cannot generally rely on the order of different state variables after simplification. However, I expect that the ODE states of one single original undiscretized variable are consecutive and accessible by indexing with a single range.

Can I rely on subsequent positions of the corresponding states in the ODEProblem?

Is there a minimum version requirement for this assumption?

For example, when a state variable `Y`

discretized over a single a dimension, I get several variables `Y[1], Y[2], ..., Y[n]`

in the ODEProblem.

If I find that `Y[1]`

is at the fourth position of the ODE state vector, `u[4]`

, can I rely on finding `Y[1:n]`

at `u[3+1:n]`

?

This worked so far for my examples and but this might be just luck.

Or do I need to explicitly set/get states by dictionary of each entry of `Y[i]`

?