@@ -51,6 +51,7 @@ jac_expr = generate_jacobian(de)
5151jac = calculate_jacobian (de)
5252jacfun = eval (jac_expr[2 ])
5353
54+ de = complete (de)
5455for f in [
5556 ODEFunction (de, [x, y, z], [σ, ρ, β], tgrad = true , jac = true ),
5657 eval (ODEFunctionExpr (de, [x, y, z], [σ, ρ, β], tgrad = true , jac = true )),
@@ -167,7 +168,7 @@ lowered_eqs = [D(uˍtt) ~ 2uˍtt + uˍt + xˍt + 1
167168
168169test_diffeq_inference (" first-order transform" , de1, t, [uˍtt, xˍt, uˍt, u, x], [])
169170du = zeros (5 )
170- ODEFunction (de1, [uˍtt, xˍt, uˍt, u, x], [])(du, ones (5 ), nothing , 0.1 )
171+ ODEFunction (complete ( de1) , [uˍtt, xˍt, uˍt, u, x], [])(du, ones (5 ), nothing , 0.1 )
171172@test du == [5.0 , 3.0 , 1.0 , 1.0 , 1.0 ]
172173
173174# Internal calculations
@@ -182,7 +183,7 @@ jac = calculate_jacobian(de)
182183@test ModelingToolkit. jacobian_sparsity (de). colptr == sparse (jac). colptr
183184@test ModelingToolkit. jacobian_sparsity (de). rowval == sparse (jac). rowval
184185
185- f = ODEFunction (de , [x, y, z], [σ, ρ, β])
186+ f = ODEFunction (complete (de) , [x, y, z], [σ, ρ, β])
186187
187188D = Differential (t)
188189@parameters A B C
@@ -208,7 +209,7 @@ function lotka(u, p, t)
208209end
209210
210211prob = ODEProblem (ODEFunction {false} (lotka), [1.0 , 1.0 ], (0.0 , 1.0 ), [1.5 , 1.0 , 3.0 , 1.0 ])
211- de = modelingtoolkitize (prob)
212+ de = complete ( modelingtoolkitize (prob) )
212213ODEFunction (de)(similar (prob. u0), prob. u0, prob. p, 0.1 )
213214
214215function lotka (du, u, p, t)
220221
221222prob = ODEProblem (lotka, [1.0 , 1.0 ], (0.0 , 1.0 ), [1.5 , 1.0 , 3.0 , 1.0 ])
222223
223- de = modelingtoolkitize (prob)
224+ de = complete ( modelingtoolkitize (prob) )
224225ODEFunction (de)(similar (prob. u0), prob. u0, prob. p, 0.1 )
225226
226227# automatic unknown detection for DAEs
@@ -579,11 +580,13 @@ eqs = [
579580]
580581
581582@named sys = ODESystem (eqs, t, [x, y, z], [α, β])
583+ sys = complete (sys)
582584@test_throws Any ODEFunction (sys)
583585
584586eqs = copy (eqs)
585587eqs[end ] = D (D (z)) ~ α * x - β * y
586588@named sys = ODESystem (eqs, t, [x, y, z], [α, β])
589+ sys = complete (sys)
587590@test_throws Any ODEFunction (sys)
588591
589592@testset " Preface tests" begin
0 commit comments