Inverse of a SUPG term

Hello,

I’m working on a SUPG-stabilised finite element solver in the FEniCSx library. Many solvers, including fund3D, Coffe …, use a very specific SUPG term and I would like to implement :

image

in many paper we can read “The inverse of the stabilization matrix is evaluated at each Gaussian quadrature point for volume integrations and [τ ] is then obtained by means of local matrix inversion”

My question is: how do I implement this term in FenicsX/UFL? It seems that `ufl.inv` won’t work for a 6×6 matrix ? I have no problem with the terms, but i have no idea for the inversion of the matrix. In fact, I think this term should also be taken into account in the differentiation of the Jacobian.

Thank you for your time; I’ll take all your suggestions on board!

I think you could do this with @a-latyshev’s external operator to do this inversion numerically with numpy: GitHub - a-latyshev/dolfinx-external-operator: Extension of DOLFINx implementing the concept of external operator · GitHub

@ruhsnay, you need to be careful with wrapping tensors with external operators, especially when you are going to compute the derivative with respect to them. If you wrap a 6x6 tensor with FEMExternalOperator, it will generate a quadrature space and FE coefficient of the size 6x6x(num of dofs of the quadrature space). If you take a derivative with respect to an operand, the library will generate a new quadrature space and a coefficient of the same size multiplied by the mathematical size of the operand. It’s a lot of RAM. Instead of wrapping the tensor itself, it’s better to represent its contraction with a vector (I assume that in your variational formulation, your [\tau] is multiplied by smth).

If you consider the differentiation of a variational form with such a term, NumPy won’t be enough. Try to use JAX instead. We have a tutorial on using JAX with external operators to solve a plasticity problem: Plasticity of Mohr-Coulomb with apex-smoothing — External operators within FEniCSx/DOLFINx.