Skip to content

Nonsensical stuff is allowed in input paraemter maps #3325

@TorkelE

Description

@TorkelE

Probably most likley to hapen when a symbolic variable is accidentally renamed. However, it seem weird that nonsensical stuff is just dismissed, instead of throwing an error:

# using MTK
using ModelingToolkit
using ModelingToolkit: t_nounits as t, D_nounits as D

t = default_t()
D = default_time_deriv()

@variables X(t)
@parameters p d
eqs = [D(X) ~ p - d*X]
@mtkbuild osys = ODESystem(eqs, t)

p = "I accidentally renamed p"
u0 = [X => 1.0]
ps = [p => 1.0, d => 0.5]
oprob = ODEProblem(osys, u0, (0.0, 1.0), ps) # ERROR: Some parameters are missing from the variable map.

@parameters p d
ps = [p => 1.0, d => 0.5, "Random stuff" => 3.0]
oprob = ODEProblem(osys, u0, (0.0, 1.0), ps) # Works.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions