Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
TorkelE opened this issue Jun 9, 2024 · 1 comment
Open

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

TorkelE opened this issue Jun 9, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@TorkelE
Copy link
Member

TorkelE commented Jun 9, 2024

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)]
@TorkelE TorkelE added the bug Something isn't working label Jun 9, 2024
@TorkelE TorkelE changed the title Indexing a solution at a time point using idxs and tuple fails [WIP] Indexing a solution at a time point using idxs and tuple fails Jun 9, 2024
@TorkelE TorkelE changed the title [WIP] Indexing a solution at a time point using idxs and tuple fails Indexing a solution at a time point using idxs and tuple fails Jun 9, 2024
oscardssmith pushed a commit to oscardssmith/SciMLBase.jl that referenced this issue Jun 11, 2024
Added trait for checking derivative requirement SciML#711
@AayushSabharwal
Copy link
Member

AayushSabharwal commented Jul 24, 2024

osol(0.0; idxs=(X, Y))

This is easy to make work. However, osol(0.0:0.1:1.0; idxs=(X, Y)) is not as simple, since it should return a DiffEqArray where .u isa Vector{Tuple{...}} which isn't valid. How would you expect this to work? Use SVector in this case instead? Or should it work identically to [X, Y]?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants