Skip to content

Commit a611042

Browse files
test: test get_updated_symbolic_problem copying guesses of algebraic variables
1 parent 1450a5f commit a611042

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

test/initializationsystem.jl

+10-2
Original file line numberDiff line numberDiff line change
@@ -1508,7 +1508,7 @@ end
15081508
@inferred solve(prob)
15091509
end
15101510

1511-
@testset "Issue#3570, #3552: `Initial`s are copied to `u0` during `solve`/`init`" begin
1511+
@testset "Issue#3570, #3552: `Initial`s/guesses are copied to `u0` during `solve`/`init`" begin
15121512
@parameters g
15131513
@variables x(t) [state_priority = 10] y(t) λ(t)
15141514
eqs = [D(D(x)) ~ λ * x
@@ -1517,9 +1517,17 @@ end
15171517
@mtkbuild pend = ODESystem(eqs, t)
15181518

15191519
prob = ODEProblem(
1520-
pend, [x => (2 / 2)], (0.0, 1.5), [g => 1], guesses ==> 1, y => 2 / 2])
1520+
pend, [x => (2 / 2), D(x) => 0.0], (0.0, 1.5),
1521+
[g => 1], guesses ==> 1, y => 2 / 2])
15211522
sol = solve(prob)
15221523

1524+
@testset "Guesses of initialization problem copied to algebraic variables" begin
1525+
prob.f.initialization_data.initializeprob[λ] = 1.0
1526+
prob2 = DiffEqBase.get_updated_symbolic_problem(
1527+
pend, prob; u0 = prob.u0, p = prob.p)
1528+
@test prob2[λ] 1.0
1529+
end
1530+
15231531
@testset "`setsym_oop`" begin
15241532
setter = setsym_oop(prob, [Initial(x)])
15251533
(u0, p) = setter(prob, [0.8])

0 commit comments

Comments
 (0)