[petsc-users] Question about DMPlexDistribute & distribute mesh over processes

Sami BEN ELHAJ SALAH sami.ben-elhaj-salah at ensma.fr
Wed May 25 12:16:46 CDT 2022

Dear PETSc developer team,

I m trying to create à jacobian_matrix from distributed DM. I have followed the two examples (snes/tests/ex2.c and ex56.c). So I wrote this routine:

PetscDM orig_dm;
PetscDM dist_dm = NULL;
PetscPartitioner part;
DMPlexGetPartitioner(orig_dm, &part);
PetscPartitionerSetType(part, PETSCPARTITIONERPARMETIS);
DMPlexDistribute(orig_dm, 0, NULL, &dist_dm);

PetscErrorCode err = DMCreateMatrix(dist_dm, &jacobian_matrix);
PetscInt M, N, m, n;
MatGetSize(jacobian_matrix, &M, &N);
MatGetLocalSize(jacobian_matrix, &m, &n);

Then I run my code with 2 processes and I obtained this result:
Size from jacobian_matrix: M=0 m =0 (this result is the same in all processes).

I didn't understand if I forgot something in my code to obtain the correct values for the local and global sizes for the jacobean_matrix? (I mean if my code is missing something to obtain a distributed mesh over processes ?)

Thank you in advance for any help!

Ingénieur de Recherche (CNRS)
Institut Pprime - ISAE - ENSMA
Email: sami.ben-elhaj-salah at ensma.fr
www.samibenelhajsalah.com <https://samiben91.github.io/samibenelhajsalah/index.html>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20220525/5d6d85af/attachment.html>

More information about the petsc-users mailing list