Skip to content

Commit 41de08f

Browse files
Merge pull request #3127 from AayushSabharwal/as/pdep-const-rhs
fix: handle parameter dependencies with constant RHS
2 parents d838bbf + 713c1cb commit 41de08f

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

src/systems/diffeqs/odesystem.jl

+1-5
Original file line numberDiff line numberDiff line change
@@ -335,11 +335,7 @@ function ODESystem(eqs, iv; kwargs...)
335335
end
336336
end
337337
for eq in get(kwargs, :parameter_dependencies, Equation[])
338-
if eq isa Pair
339-
collect_vars!(allunknowns, ps, eq, iv)
340-
else
341-
collect_vars!(allunknowns, ps, eq, iv)
342-
end
338+
collect_vars!(allunknowns, ps, eq, iv)
343339
end
344340
for ssys in get(kwargs, :systems, ODESystem[])
345341
collect_scoped_vars!(allunknowns, ps, ssys, iv)

src/utils.jl

+2
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,7 @@ end
252252

253253
function collect_defaults!(defs, vars)
254254
for v in vars
255+
symbolic_type(v) == NotSymbolic() && continue
255256
if haskey(defs, v) || !hasdefault(unwrap(v)) || (def = getdefault(v)) === nothing
256257
continue
257258
end
@@ -262,6 +263,7 @@ end
262263

263264
function collect_var_to_name!(vars, xs)
264265
for x in xs
266+
symbolic_type(x) == NotSymbolic() && continue
265267
x = unwrap(x)
266268
if hasmetadata(x, Symbolics.GetindexParent)
267269
xarr = getmetadata(x, Symbolics.GetindexParent)

test/odesystem.jl

+5
Original file line numberDiff line numberDiff line change
@@ -1442,3 +1442,8 @@ end
14421442
end
14431443
end
14441444
end
1445+
1446+
@testset "Parameter dependencies with constant RHS" begin
1447+
@parameters p
1448+
@test_nowarn ODESystem(Equation[], t; parameter_dependencies = [p ~ 1.0], name = :a)
1449+
end

0 commit comments

Comments
 (0)