[petsc-users] Question about DMPlexDistribute & distribute mesh over processes
Toby Isaac
toby.isaac at gmail.com
Wed May 25 12:41:30 CDT 2022
Hi Sami,
Just to verify: if you call DMCreateMatrix() on orig_dm, do you get a
Jacobian matrix?
The DMPlex must be told what kind of discretized fields you want a
matrix for and what equations you are discretizing. This is handled
by the PetscDS object. In snes/tutorials/ex59.c, see the code after
DMGetDS() for an example.
- Toby
On Wed, May 25, 2022 at 1:17 PM Sami BEN ELHAJ SALAH
<sami.ben-elhaj-salah at ensma.fr> wrote:
>
> 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!
> Sami,
>
>
> --
> Dr. Sami BEN ELHAJ SALAH
> Ingénieur de Recherche (CNRS)
> Institut Pprime - ISAE - ENSMA
> Mobile: 06.62.51.26.74
> Email: sami.ben-elhaj-salah at ensma.fr
> www.samibenelhajsalah.com
>
>
>
More information about the petsc-users
mailing list