On Wed, Dec 10, 2025 at 8:14 AM Noam T. via petsc-users <
[email protected]> wrote:
> Hello,
>
> In an old question about obtaining the node connectivity of a cell with a
> high order approximation space,
>
This is the misunderstanding here. What I implemented was visualization for
meshes with high order _coordinate_ spaces. I am "guaranteed" that this
will work because I know that coordinates are discretized with Lagrange
spaces. I did not do this for approximation spaces because I can't
guarantee this.
We could do the same thing for approximation spaces, and I would be happy
to help you factor it out. In general, I would need to figure out the
smallest DG space containing the approximation space (don't know how to do
yet, but possible), then project to that first and start the descent as
before.
Thanks,
Matt
> 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!ekDGozJlgGi9X5H88PnWzpu8atTA6FPYDxbKBZbEfCAjP3O-HlOcRx5bJdDfiII0H3rwmPSpEjZTGy6TVz1M$
>
> <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
>
--
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://urldefense.us/v3/__https://www.cse.buffalo.edu/*knepley/__;fg!!G_uCfscf7eWS!ekDGozJlgGi9X5H88PnWzpu8atTA6FPYDxbKBZbEfCAjP3O-HlOcRx5bJdDfiII0H3rwmPSpEjZTG4wF9UiD$
<https://urldefense.us/v3/__http://www.cse.buffalo.edu/*knepley/__;fg!!G_uCfscf7eWS!ekDGozJlgGi9X5H88PnWzpu8atTA6FPYDxbKBZbEfCAjP3O-HlOcRx5bJdDfiII0H3rwmPSpEjZTG1crZ2Aa$
>