You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# defer initialization until defaults are merged below
49
-
push!(filtered_u0, y => x[2])
50
-
elseif y isa Symbolics.Arr
51
-
# scalarize array # TODO: don't scalarize arrays
52
-
_y =collect(y)
53
-
for i ineachindex(_y)
54
-
push!(filtered_u0, _y[i] => x[2][i])
55
-
end
56
-
elseif y isa Symbolics.BasicSymbolic
57
-
# y is a derivative expression expanded
58
-
# add to the initialization equations
59
-
push!(eqs_ics, y ~ x[2])
60
-
else
61
-
error("Initialization expression $y is currently not supported. If its a higher order derivative expression, then only the dummy derivative expressions are supported.")
62
-
end
34
+
if!isnothing(schedule)
35
+
for x infilter(x ->!isnothing(x[1]), schedule.dummy_sub)
36
+
# set dummy derivatives to default_dd_guess unless specified
# y is a derivative expression expanded; add it to the initialization equations
50
+
push!(eqs_ics, y ~ x)
51
+
else
52
+
error("Initialization expression $y is currently not supported. If its a higher order derivative expression, then only the dummy derivative expressions are supported.")
63
53
end
64
-
filtered_u0 =todict(filtered_u0)
65
54
end
66
-
else
67
-
dd_guess =Dict()
68
-
filtered_u0 =todict(u0map)
69
55
end
70
56
71
-
defs =merge(defaults(sys), filtered_u0)
72
-
73
-
for st in full_states
74
-
if st ∈keys(defs)
75
-
def = defs[st]
76
-
77
-
if def isa Equation
78
-
st ∉keys(guesses) && check_defguess &&
79
-
error("Invalid setup: unknown $(st) has an initial condition equation with no guess.")
80
-
push!(eqs_ics, def)
81
-
push!(u0, st => guesses[st])
82
-
else
83
-
push!(eqs_ics, st ~ def)
84
-
push!(u0, st => def)
85
-
end
86
-
elseif st ∈keys(guesses)
87
-
push!(u0, st => guesses[st])
57
+
# 2) process other variables
58
+
for var in vars
59
+
if var ∈keys(defs)
60
+
push!(eqs_ics, var ~ defs[var])
61
+
elseif var ∈keys(guesses)
62
+
push!(defs, var => guesses[var])
88
63
elseif check_defguess
89
-
error("Invalid setup: unknown$(st) has no default value or initial guess")
64
+
error("Invalid setup: variable$(var) has no default value or initial guess")
90
65
end
91
66
end
92
67
68
+
# 3) process explicitly provided initialization equations
93
69
if!algebraic_only
94
-
for eq in [get_initialization_eqs(sys); initialization_eqs]
0 commit comments