[petsc-users] DMPlex periodic face coordinates
Matteo Semplice
matteo.semplice at uninsubria.it
Mon May 13 23:14:43 CDT 2024
Dear petsc-users,
I am playing with DMPlexGetCellCoordinates and observing that it
returns correct periodic coordinates for cells, but not for faces.
More precisely, adding
PetscCall(DMPlexGetHeightStratum(dm, 1, &fStart, &fEnd));
for (f = fStart; f < fEnd; ++f) {
const PetscScalar *array;
PetscScalar *x = NULL;
PetscInt ndof;
PetscBool isDG;
PetscCall(DMPlexGetCellCoordinates(dm, f, &isDG, &ndof, &array, &x));
PetscCheck(ndof % cdim == 0, PETSC_COMM_SELF,
PETSC_ERR_ARG_INCOMP, "ndof not divisible by cdim");
PetscCall(PetscPrintf(PETSC_COMM_SELF, "Face #%" PetscInt_FMT "
coordinates\n", f - fStart));
for (PetscInt i = 0; i < ndof; i += cdim)
PetscCall(PetscScalarView(cdim, &x[i], PETSC_VIEWER_STDOUT_SELF));
PetscCall(DMPlexRestoreCellCoordinates(dm, f, &isDG, &ndof,
&array, &x));
}
to src/dm/impls/plex/tutorials/ex8.c, I get
$ ./ex8 -dm_plex_dim 2 -petscspace_degree 1 -dm_plex_simplex 0
-dm_plex_box_faces 3,2 -dm_plex_box_bd periodic,none -dm_view -view_coord
DM Object: box 1 MPI process
type: plex
box in 2 dimensions:
Number of 0-cells per rank: 9
Number of 1-cells per rank: 15
Number of 2-cells per rank: 6
Periodic mesh (PERIODIC, NONE) coordinates localized
[...]
Element #2 coordinates
0: 6.6667e-01 0.0000e+00
0: 1.0000e+00 0.0000e+00 <<<----- correct
0: 1.0000e+00 5.0000e-01
0: 6.6667e-01 5.0000e-01
[...]
Face #0 coordinates
0: 0.0000e+00 0.0000e+00
0: 3.3333e-01 0.0000e+00
Face #1 coordinates
0: 3.3333e-01 0.0000e+00
0: 6.6667e-01 0.0000e+00
Face #2 coordinates
0: 6.6667e-01 0.0000e+00
0: 0.0000e+00 0.0000e+00 <<<---- should be (0.66,0.00) and
(1.00,0.00)
Is there a way to recover correct periodic coordinates in the case of
periodic DMPLex?
Thanks in advance
Matteo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20240514/6e56a8ae/attachment-0001.html>
More information about the petsc-users
mailing list