Skip to content

Commit 82e31d1

Browse files
committed
defaults in modelingtoolkitize
1 parent 85c5b40 commit 82e31d1

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/systems/diffeqs/modelingtoolkitize.jl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,18 @@ function modelingtoolkitize(prob::DiffEqBase.ODEProblem)
4242

4343
eqs = vcat([lhs[i] ~ rhs[i] for i in eachindex(prob.u0)]...)
4444

45+
sts = Vector(vec(vars))
4546
params = if ndims(params) == 0
4647
[params[1]]
4748
else
4849
Vector(vec(params))
4950
end
5051

51-
de = ODESystem(eqs,t,Vector(vec(vars)),params)
52+
de = ODESystem(
53+
eqs, t, sts, params,
54+
default_u0=Dict(sts .=> prob.u0),
55+
default_p=Dict(params .=> prob.p)
56+
)
5257

5358
de
5459
end

0 commit comments

Comments
 (0)