How to solve multiple problems in parallel (not domain decomposition)

Failing to run mpirun with a Python script in Ubuntu, I come back and try to implement the parallel computing directly in the edp file. Again, the problem is with domain decomposition. So Mat is a type in PETSc, but the function createMat is in macro_ddm.idp. I can’t use it without loading macro_ddm.idp. Can I create a Mat type without using this function?

Yes, of course, as I’ve already told you in the past…

The example in the link includes macro_ddm.idp.

So? The particular lines that are highlighted do not use any stuff from macro_ddm.idp.

But the matrix A is created using createMat, which is included in macro_ddm.idp. If A is created using the regular method, then I can’t use KSPSolve to solve the multiple rhs problem.

I have tried to solve the multiple rhs problem using the regular method by something like sol = A^-1*rhs , where rhs is also a matrix (with or without the brackets syntax in different places), but the solution is always wrong, like the one in my previous post https://community.freefem.org/t/how-to-solve-multiple-problems-in-parallel-not-domain-decomposition/1767/17. Can someone explain why this simple method fails?

But the matrix A is created using createMat

Again, the particular lines that are highlighted in the last link I sent do not use a Mat called A, but rather Wn.

Finally, I created the system matrix by one line:

Mat<complex> A(Vh.ndof, communicator = mpiCommSelf);

Yes, precisely the line I highlighted 2 months ago.