Skip to content

Commit 4495721

Browse files
(MAYBE) fix: handle scalarized parameters in initialization equations
1 parent 0e83102 commit 4495721

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/systems/nonlinear/initializesystem.jl

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,20 @@ function generate_initializesystem(sys::ODESystem;
110110
error("Invalid setup: parameter $(p) has no default value or initial guess")
111111
end
112112
push!(u0, varp => guesses[p])
113+
elseif Symbolics.isarraysymbolic(p) && Symbolics.shape(p) != Symbolics.Unknown()
114+
for _p in collect(p)
115+
if (_val1 = get(pmap, _p, nothing)) === missing || get(defs, _p, nothing) === missing
116+
varp = tovar(_p)
117+
paramsubs[_p] = varp
118+
if _val1 !== nothing && _val1 !== missing
119+
push!(eqs_ics, varp ~ _val1)
120+
end
121+
if !haskey(guesses, _p)
122+
error("Invalid setup: parameter $(_p) has no default value or initial guess")
123+
end
124+
push!(u0, varp => guesses[_p])
125+
end
126+
end
113127
end
114128
end
115129
pars = vcat(

0 commit comments

Comments
 (0)