Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nonsensical stuff is allowed in input paraemter maps #3325

Open
TorkelE opened this issue Jan 15, 2025 · 0 comments
Open

Nonsensical stuff is allowed in input paraemter maps #3325

TorkelE opened this issue Jan 15, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@TorkelE
Copy link
Member

TorkelE commented Jan 15, 2025

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.
@TorkelE TorkelE added the bug Something isn't working label Jan 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant