Handle inverses of matrices
So far, using the Inverse
node from UFL will fail in horrible ways because:
- It is removed in
algebra_lowering
with Cramers rule, which is only implemented up ton=4
- Turning that off will make AD fail
I have now figured out how to do it:
- Monkey patch algebraic lowering to leave
Inverse
nodes untouched (if of a certain size??) - Skip quadrature degree estimation in presence of
Inverse
nodes and enforce user input for quadrature size - Monkey patch AD code using the following easy identity:
\partial A^{-1} = -A^{-1}\partial A A^{-1}
- Implement a handler for
Inverse
, which forces the argument to be assebled into aDune::FieldMatrix
and callesinverse
on that matrix
The application where this happens is Maxwell DG with Flux Vector Splitting.
Edited by Dominic Kempf