[petsc-users] DMGetCoordinatesLocal and DMPlexGetCellCoordinates in PETSc > 3.18

Berend van Wachem berend.vanwachem at ovgu.de
Wed May 17 09:00:13 CDT 2023


Dear PETSc Team,

We are using DMPlex, and we create a mesh using

DMPlexCreateBoxMesh (.... );

and get a uniform mesh. The mesh is periodic.

We typically want to "scale" the coordinates (vertices) of the mesh, and 
to achieve this, we call

DMGetCoordinatesLocal(dm, &coordinates);

and scale the entries in the Vector coordinates appropriately.

and then

DMSetCoordinatesLocal(dm, coordinates);


After this, we localise the coordinates by calling

DMLocalizeCoordinates(dm);

This worked fine up to PETSc 3.18, but with versions after this, the 
coordinates we get from the call

DMPlexGetCellCoordinates(dm, CellID, &isDG, &CoordSize, 
&ArrayCoordinates, &Coordinates);

are no longer correct if the mesh is periodic. A number of the 
coordinates returned from calling DMPlexGetCellCoordinates are wrong.

I think, this is because DMLocalizeCoordinates is now automatically 
called within the routine DMPlexCreateBoxMesh.

So, my question is: How should we scale the coordinates from a periodic 
DMPlex mesh so that they are reflected correctly when calling both 
DMGetCoordinatesLocal and DMPlexGetCellCoordinates, with PETSc versions 
 >= 3.18?

Many thanks, Berend.


More information about the petsc-users mailing list