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 initialize tspan from defaults or initialization equations #3359

Open
hersle opened this issue Jan 30, 2025 · 0 comments
Open

Cannot initialize tspan from defaults or initialization equations #3359

hersle opened this issue Jan 30, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@hersle
Copy link
Contributor

hersle commented Jan 30, 2025

It would be very nice of one could initialize t from an unknown, observed or parameter in the initialization system, just like one can already do for other variables:

using ModelingToolkit, Test
using ModelingToolkit: t_nounits as t, D_nounits as D
@variables x(t)
@named sys = ODESystem([D(x) ~ 0.0], t; defaults = [t => 1/x])
sys = structural_simplify(sys)

prob = ODEProblem(sys, [x => 2.0], (NaN, 1.0), [])
@test solve(prob).t[begin]  0.5

prob2 = remake(prob; u0 = [x => 4.0])
@test solve(prob2).t[begin]  0.25
@hersle hersle added the bug Something isn't working label Jan 30, 2025
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

1 participant