On Wed, May 17, 2023 at 10:02 AM Berend van Wachem <berend.vanwac...@ovgu.de> wrote:
> 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? > I think we might have to add an API function. For now, when you scale the coordinates, can you scale both copies? DMGetCoordinatesLocal() DMGetCellCoordinatesLocal(); and then set them back. Thanks, Matt > Many thanks, Berend. -- What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead. -- Norbert Wiener https://www.cse.buffalo.edu/~knepley/ <http://www.cse.buffalo.edu/~knepley/>