Skip to content

Commit 5e439ed

Browse files
fix: don't substitute inside Initial in build_operating_point!
1 parent 60e202e commit 5e439ed

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

src/systems/problem_utils.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -623,12 +623,12 @@ function build_operating_point!(sys::AbstractSystem,
623623
end
624624

625625
for k in keys(u0map)
626-
v = fixpoint_sub(u0map[k], neithermap)
626+
v = fixpoint_sub(u0map[k], neithermap; operator = Symbolics.Operator)
627627
isequal(k, v) && continue
628628
u0map[k] = v
629629
end
630630
for k in keys(pmap)
631-
v = fixpoint_sub(pmap[k], neithermap)
631+
v = fixpoint_sub(pmap[k], neithermap; operator = Symbolics.Operator)
632632
isequal(k, v) && continue
633633
pmap[k] = v
634634
end

test/initial_values.jl

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,3 +236,19 @@ end
236236
prob2 = remake(prob; p = p_new)
237237
@test prob2.ps[interp] == spline2
238238
end
239+
240+
@testset "Issue#3523: don't substitute inside initial in `build_operating_point!`" begin
241+
@variables (X(t))[1:2]
242+
@parameters p[1:2]
243+
eqs = [
244+
0 ~ p[1] - X[1],
245+
0 ~ p[2] - X[2]
246+
]
247+
@named nlsys = NonlinearSystem(eqs)
248+
nlsys = complete(nlsys)
249+
250+
# Creates the `NonlinearProblem`.
251+
u0 = [X => [1.0, 2.0]]
252+
ps = [p => [4.0, 5.0]]
253+
@test_nowarn NonlinearProblem(nlsys, u0, ps)
254+
end

0 commit comments

Comments
 (0)