Description
When solving for consistent initial conditions (among other applications, I'm sure), it is useful to know which ContinuousSet
s 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_eq
s 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 Constraint
s we iterate over Var
s?) and relies on discretization equations having the correct name.
How hard would it be to give disc_eq
s 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.