Skip to content

Commit f156381

Browse files
committed
Prioritize filtered_u0 deferral when creating initialization system
1 parent 76bff8f commit f156381

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/systems/nonlinear/initializesystem.jl

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,10 @@ function generate_initializesystem(sys::ODESystem;
4444
y = get(schedule.dummy_sub, x[1], x[1])
4545
y = ModelingToolkit.fixpoint_sub(y, full_diffmap)
4646

47-
if y isa Symbolics.Arr
47+
if y set_full_states
48+
# defer initialization until defaults are merged below
49+
push!(filtered_u0, y => x[2])
50+
elseif y isa Symbolics.Arr
4851
_y = collect(y)
4952

5053
# TODO: Don't scalarize arrays
@@ -55,8 +58,6 @@ function generate_initializesystem(sys::ODESystem;
5558
# y is a derivative expression expanded
5659
# add to the initialization equations
5760
push!(eqs_ics, y ~ x[2])
58-
elseif y set_full_states
59-
push!(filtered_u0, y => x[2])
6061
else
6162
error("Initialization expression $y is currently not supported. If its a higher order derivative expression, then only the dummy derivative expressions are supported.")
6263
end

0 commit comments

Comments
 (0)