Skip to content

Hard to tell what ContinuousSet(s) a disc_eq is discretizing #1411

Open
@Robbybp

Description

@Robbybp

When solving for consistent initial conditions (among other applications, I'm sure), it is useful to know which ContinuousSets a ..._disc_eq is discretizing. For some simple cases, this can be done by:

for var in identify_variables(disc_eq[index].expr):
    if isinstance(var, DerivativeVar):
        wrt = var.get_continuousset_list()

This is slower than necessary and not reliable if multiple derivatives are present in the discretization equation. I think the current most reliable way identify _disc_eqs with respect to a particular set is to iterate over DerivativeVars, check for those with respect to the set, then find the constraint with the corresponding ..._disc_eq name. This is non-intuitive (to find some Constraints we iterate over Vars?) and relies on discretization equations having the correct name.

How hard would it be to give disc_eqs a continuousset_list attribute or method? It would be nice if we had a DiscEq subclass of Constraint, although this may cause its own trouble.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions