-
-
Notifications
You must be signed in to change notification settings - Fork 236
Open
Description
As described here: https://discourse.julialang.org/t/indexing-a-residual-of-an-initializationproblem/123356?u=bart_van_de_lint
Symbolic indexing on the residual of a solution is not possible yet. This would be a good debugging tool. I would suggest this feature to work similarly to normal symbolic indexing. So instead of sol[symbol] it would work like sol.resid[symbol].
Example:
using ModelingToolkit, OrdinaryDiffEq
using ModelingToolkit: t_nounits as t, D_nounits as D
@parameters g
@variables x(t) y(t) [state_priority = 10] λ(t)
eqs = [D(D(x)) ~ λ * x
D(D(y)) ~ λ * y - g
x^2 + y^2 ~ 1]
@mtkbuild pend = ODESystem(eqs, t)
iprob = ModelingToolkit.InitializationProblem(pend, 0.0,
[x => 1, y => 0.0, D(y) => 2.0, λ => 1], [g => 1], guesses = [λ => 1])
using NonlinearSolve
sol = solve(iprob)
sol.resid[x] # indexing the residualMetadata
Metadata
Assignees
Labels
No labels