[petsc-users] Use of flag dm_plex_high_order_view

Noam T. dontbugthedevs at proton.me
Wed Dec 10 07:14:06 CST 2025


Hello,

In an old question about obtaining the node connectivity of a cell with a high order approximation space, the use of the flag "-dm_plex_high_order_view" for visualization purposes was brought up, as a way to refine the grid down to linear space.

Link: https://urldefense.us/v3/__https://gitlab.com/petsc/petsc/-/blob/main/src/dm/impls/plex/plex.c?ref_type=heads*L2021__;Iw!!G_uCfscf7eWS!ZZVaar4OGVdTXOAAjkEadcw-CAZUpAAzibpD_2SKpRupYG4oxSH-W7u5necsgTYDii6v-1kjfV4aqsllxL9XI_hK2YITfNz-$ 

I'm trying to make use of this flag to see the refinement, but I see no difference with higher order approximations. Perhaps I am misunderstanding its use? I thought that by using it, one could see a "subdivision" of each element. Say, a single triangle, FE approximation space order 2 (3 corner nodes, 3 mid-edge nodes), would be refined into e.g. 4 linear triangles.

The code (Fortran) looks something along these lines:

! Create a DM from the mesh file

DM :: cdm
PetscInt :: K, cdim, fedim
PetscBool :: simplex
PetscFE :: cfe
PetscViewer :: viewer
PetscErrorCode :: ierr

PetsCallA(DMSetFromOptions(cdm, ierr))
PetsCallA(DMGetDimension(cdm, cdim, ierr))
PetsCallA(DMPlexSimplex(cdm, simplex, ierr))
PetsCallA(PetscFECreateDefault(PETSC_COMM_WORLD, cdim, cdim, simplex, "ho_", K, cfe, ierr))
PetsCallA(PetscFEGetDimension(cfe, fedim, ierr))

PetsCallA(PetscViewerCreate(PETSC_COMM_WORLD, viewer, ierr))
PetsCallA(PetscViewerDrawOpen(PETSC_COMM_WORLD, PETSC_NULL_CHARACTER, PETSC_NULL_CHARACTER, 100, 100, 800, 800, viewer, ierr))
PetsCallA(PetscViewerSetFromOptions(viewer, ierr)) ! also using flag -draw_pause 5
PetsCallA(DMView(cdm, viewer, ierr))
[...]

With the following list of flags:

-ho_petscspace_degree K
-ho_petscdualspace_lagrange_node_type equispaced
-ho_petscdualspace_lagrange_node_endpoints 1
-dm_plex_high_order_view
-options_left

Using "-options_left" shows that "there are no unused options"; so "-dm_plex_high_order_view" is used somehow; it is at least required for the call to "DMPlexCreateHighOrderSurrogate_Internal" within the "draw" functions.

>From the CoordinateDM I can see the additional nodes created for the higher order approximation (e.g. mid-edge, mid-face nodes), so it seems the FE space is correct.

Regardless of the order "K", the mesh plotted with "DMView" is always the same, corresponding to the linear case.

Thank you.

Noam
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20251210/177d88f2/attachment.html>


More information about the petsc-users mailing list