Open
Description
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