Skip to content

Commit 8d0c407

Browse files
test: test remake edge case
1 parent 7b20996 commit 8d0c407

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

test/downstream/modelingtoolkit_remake.jl

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -380,3 +380,20 @@ end
380380
@test prob2.ps[p] 3.0
381381
end
382382
end
383+
384+
# https://github.com/SciML/ModelingToolkit.jl/issues/3326
385+
@testset "Remake with non-substitute-able values" begin
386+
@variables x1(t) x2(t) y(t)
387+
@parameters k2 p Gamma y0 d k1
388+
@mtkbuild sys = ODESystem([D(y) ~ p - d * y, D(x1) ~ -k1 * x1 + k2 * (Gamma - x1), x2 ~ Gamma - x1], t; defaults = Dict(y => y0, Gamma => x1 + x2))
389+
u0 = [x1 => 1.0, x2 => 2.0]
390+
p0 = [p => 10.0, d => 5.0, y0 => 3.0, k1 => 1.0, k2 => 2.0]
391+
prob = ODEProblem(sys, u0, (0.0, 1.0), p0)
392+
u0_new = [x1 => 0.1]
393+
ps_new = [y0 => 0.3, p => 100.0]
394+
prob2 = remake(prob; u0 = u0_new, p = ps_new)
395+
@test prob2[x1] 0.1
396+
@test prob2[y] 0.3
397+
# old value retained
398+
@test prob2.ps[Gamma] 3.0
399+
end

0 commit comments

Comments
 (0)