[petsc-users] Creating a 3D dmplex mesh with cell list and distributing it

Swarnava Ghosh swarnava89 at gmail.com
Wed Aug 14 16:29:14 CDT 2019


Hi PETSc team and users,

I am trying to create a 3D dmplex mesh using DMPlexCreateFromCellList, then
distribute it, and find out the coordinates of the vertices owned by each
process.
My cell list is as follows:
numCells: 6
numVertices: 7
numCorners: 4
cells:
0
3
2
1
4
0
2
1
6
4
2
1
3
6
2
1
5
4
6
1
3
5
6
1
vertexCoords:
-6.043000
-5.233392
-4.924000
-3.021500
0.000000
-4.924000
-3.021500
-3.488928
0.000000
-6.043000
1.744464
0.000000
0.000000
-5.233392
-4.924000
3.021500
0.000000
-4.924000
3.021500
-3.488928
0.000000

After reading this information, I do
 ierr=
DMPlexCreateFromCellList(PETSC_COMM_WORLD,3,pCgdft->numCellsESP,pCgdft->NESP,pCgdft->numCornersESP,interpolate,pCgdft->cellsESP,3,pCgdft->vertexCoordsESP,&pCgdft->dmplex);

ierr = DMPlexDistribute(pCgdft->dmplex,0,&pCgdft->dmplexSF,
&distributedMesh);CHKERRQ(ierr);

   if (distributedMesh) {
     printf("mesh is distributed \n");
   ierr = DMDestroy(&pCgdft->dmplex);CHKERRQ(ierr);
     pCgdft->dmplex  = distributedMesh;
  }

 DMGetCoordinates(pCgdft->dmplex,&VC);
 VecView(VC,PETSC_VIEWER_STDOUT_WORLD);

On running this with 3 mpi processes, From VecView, I see that all the
processes own all the vertices.  Why is the dmplex not being distributed?

The VecView is :
Process [0]
-6.043
-5.23339
-4.924
-3.0215
0.
-4.924
-3.0215
-3.48893
0.
-6.043
1.74446
0.
0.
-5.23339
-4.924
3.0215
0.
-4.924
3.0215
-3.48893
0.
Process [1]
-6.043
-5.23339
-4.924
-3.0215
0.
-4.924
-3.0215
-3.48893
0.
-6.043
1.74446
0.
0.
-5.23339
-4.924
3.0215
0.
-4.924
3.0215
-3.48893
0.
Process [2]
-6.043
-5.23339
-4.924
-3.0215
0.
-4.924
-3.0215
-3.48893
0.
-6.043
1.74446
0.
0.
-5.23339
-4.924
3.0215
0.
-4.924
3.0215
-3.48893
0.

Thanks,
SG
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20190814/f939a50c/attachment.html>


More information about the petsc-users mailing list