SciML / SciMLBase.jl

The Base interface of the SciML ecosystem
https://docs.sciml.ai/SciMLBase/stable
MIT License
118 stars 91 forks source link

Indexing a solution at a time point using `idxs` and tuple fails #711

Open TorkelE opened 3 weeks ago

TorkelE commented 3 weeks ago

MWE:

using ModelingToolkit, OrdinaryDiffEq
using ModelingToolkit: t_nounits as t, D_nounits as D

@parameters p d 
@variables X(t) Y(t)
eqs = [
    D(X) ~ p - d*X,
    Y ~ X + 1
]
@mtkbuild osys = ODESystem(eqs, t)

u0 = [X => 1.0, Y => 1.0]
tspan = (0.0, 100.0)
ps = [p => 1.0, d => 0.1]

oprob = ODEProblem(osys, u0, tspan, ps)
osol = solve(oprob)

# Yields `ERROR: Incorrect specification of `idxs``
osol(0.0; idxs=(X, Y))
osol(0.0; idxs=(osys.X, osys.Y))
osol(0.0; idxs=(:X, :Y))

# All works
osol[(X, Y)]
osol[(osys.X, osys.Y)]
osol[(:X, :Y)]