Closed hersle closed 3 weeks ago
Sorry, think I disagree with myself. I should probably have used initialization_eqs = [y ~ z]
instead and solve
the problem:
using ModelingToolkit
using ModelingToolkit: t_nounits as t, D_nounits as D
using DifferentialEquations
@variables x(t) y(t) z(t)
@mtkbuild sys = ODESystem([
D(x) ~ 0.0
D(y) ~ 0.0
z ~ 2.0
], t; initialization_eqs = [y ~ z])
prob = ODEProblem(sys, [x => 1.0], (0.0, 1.0), [])
sol = solve(prob)
Now sol[y] == 2.0
, as expected.
Okay so all of your issues are now handled?
Not quite 😅 I have some workarounds here and there in my real application. But I will try to cook them down to better MWEs first. But it is improving every day!
I expect this to work:
I specified
x => 1.0
, and the default should makey => z ~ 2.0
. But (on master) it fails with