MatMatMult of PETSC

Hello everyone,

I am working on time step control of the Cahn-Hilliard equation for Explicit Euler integration. It is bounded with an evaluation of the multiplication of the inversed mass matrix (in this case lumped) and stiffness matrix of the problem. The method seems to work quite well, but the calculation time is enhanced because of the numpy matrix multiplication. Can I somehow use PETSC MatMatMul operation and would it decrease calculation time?

Path of least resistance is to use petsc4py matmult.

You can get the PETSc mat in DOLFIN’s python layer pretty easily assuming your compilation of DOLFIN has been configured with petsc4py

A = PETScMatrix()
A_petsc = A.mat()

Thank you for the answer! It worked perfectly!