Skip to content

Superfluous parameter and initial condition values can be provided to Problems #2779

Open
@TorkelE

Description

@TorkelE

In this MWE we provide the values of Y and r to the ODEProblem. Since these are not part of the ODESystem, the user have probably done something wrong, and an error should be thrown.

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

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

u0 = [X => 1.0, Y => 1.0]
tspan = (0.0, 100.0)
ps = [p => 1.0, d => 1.0, r => 1.0]

prob = ODEProblem(osys, u0, tspan, ps) # works fine

The values are filtered away in the resulting problem, e.g.

prob[Y]
prob.ps[r]

both yields errors.

the same is the case for the other problem types as well.

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions