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

Cannot index nonlinear and steady state solutions with tuples #710

Closed
TorkelE opened this issue Jun 9, 2024 · 2 comments · Fixed by #745
Closed

Cannot index nonlinear and steady state solutions with tuples #710

TorkelE opened this issue Jun 9, 2024 · 2 comments · Fixed by #745
Labels
bug Something isn't working

Comments

@TorkelE
Copy link
Member

TorkelE commented Jun 9, 2024

This works for other problem types though

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

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

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

prob = SteadyStateProblem(osys, u0, ps)
sol = solve(prob, DynamicSS(Tsit5()))

# All yields `ERROR: Invalid indexing of solution`
sol[(X, Y)]
sol[(osys.X, osys.Y)]
sol[(:X, :Y)]

eqs = [
    0 ~ p - d*X,
    0 ~ p - d*Y,
]
@mtkbuild nsys = NonlinearSystem(eqs)

u0 = [X => 1.0, Y => 1.0]
ps = [p => 1.0, d => 1.0]

prob = NonlinearProblem(nsys, u0, ps)
sol = solve(prob)

# All yields `ERROR: Invalid indexing of solution`
sol[(X, Y)]
sol[(osys.X, osys.Y)]
sol[(:X, :Y)]
@AayushSabharwal
Copy link
Member

This is fixed now

@AayushSabharwal
Copy link
Member

#745 re-enables tests for this

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

Successfully merging a pull request may close this issue.

2 participants