Changing PETSc communicator

Hello everyone,

I would like to run PETSc on a subset of MPI_COMM_WORLD, hence I would like to create a smaller communicator and I was wondering where to add it in the source files (since It can not be modified in a script file like in a c++ code). I tried to declare it in PETSc-code.hpp before the initialization of PETSc but my code dead locked.

I’d appreciate any feedback on this problem.

You can define your own communicator in the .edp and pass that to the Mat constructor using the parameter communicator. See, e.g., FreeFem-sources/diffusion-cartesian-2d-PETSc.edp at develop · FreeFem/FreeFem-sources · GitHub.