Skip to content

Commit 7cb12ed

Browse files
fix: handle recursive default edge case in initializesystem
1 parent e89e18e commit 7cb12ed

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/systems/nonlinear/initializesystem.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,10 @@ function generate_initializesystem(sys::AbstractSystem;
8989
function process_u0map_with_dummysubs(y, x)
9090
y = get(schedule.dummy_sub, y, y)
9191
y = fixpoint_sub(y, diffmap)
92+
# If we have `D(x) ~ x` and provide [D(x) => x, x => 1.0] to `u0map`, then
93+
# without this condition `defs` would get `x => x` instead of retaining
94+
# `x => 1.0`.
95+
isequal(y, x) && return
9296
if y vars_set
9397
# variables specified in u0 overrides defaults
9498
push!(defs, y => x)

0 commit comments

Comments
 (0)