Skip to content

Passing Initials as parameters does not work consistently #3645

@hersle

Description

@hersle

It is encouraged to get/set initial ODE values with e.g.

prob.ps[Initial(x)] = 1.0

Therefore, for consistency, I really think it should also work to create an ODEProblem like this:

using ModelingToolkit, OrdinaryDiffEq
using ModelingToolkit: t_nounits as t, D_nounits as D
@variables x(t)
@named M = ODESystem([D(x) ~ 0], t)
Ms = structural_simplify(M)
prob = ODEProblem(Ms, [], (0.0, 1.0), [Initial(x) => 1.0])

However, this fails:

ERROR: Initialization incomplete. Not all of the state variables of the
DAE system can be determined by the initialization. Missing
variables:

Any[x(t)]

I think Initial(x) should be recognized as a parameter consistently across XProblem, remake, setp, getp, etc.

Metadata

Metadata

Assignees

No one assigned

    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