-
Notifications
You must be signed in to change notification settings - Fork 567
Description
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.