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

variable substitution and solved states not applied to symbolic callback expressions #1721

Closed
wsphillips opened this issue Aug 2, 2022 · 1 comment

Comments

@wsphillips
Copy link
Contributor

wsphillips commented Aug 2, 2022

We get orphaned symbolics in the function bodies of generated callback functions because symbolic callbacks don't apply substitutions and solved states generated during structural_simplify.

# nonsense example but demos the problem
using ModelingToolkit, OrdinaryDiffEq

@variables t x(t) y(t)
@parameters τ
D = Differential(t)
@named fol_separate = ODESystem([ y  ~ 1 - x, D(x) ~ y/τ]; discrete_events = [(y == 4.0) => [x ~ x + 10]])
fol_simplified = structural_simplify(fol_separate)
ModelingToolkit.get_discrete_events(fol_simplified) # still has y(t) state
prob = ODEProblem(fol_simplified, [x => 0.0], (0.0,10.0), [τ => 3.0]) # missing preface + substitution
sol = solve(prob, Tsit5()) # error
@wsphillips wsphillips changed the title alias_elimination pass not applied to symbolic callback expressions variable substitution omitted for symbolic callback expressions during structural_simplify Aug 3, 2022
@wsphillips wsphillips changed the title variable substitution omitted for symbolic callback expressions during structural_simplify variable substitution and solved states not applied to symbolic callback expressions Aug 3, 2022
@wsphillips
Copy link
Contributor Author

I realized this is a duplicate of #1396 and #1646 so I'm closing this one

@wsphillips wsphillips closed this as not planned Won't fix, can't repro, duplicate, stale Aug 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant