[petsc-users] dm_view of high-order geometry/solution

Jed Brown jed at jedbrown.org
Mon Jun 12 10:53:39 CDT 2023


Duan Junming <junming.duan at epfl.ch> writes:

> Dear Jed,
>
>
> Thank you for the suggestion.
>
> When I run tests/ex33.c with
>
> ./ex33 -dm_plex_simplex 0 -dm_plex_box_faces 1,1 -mesh_transform annulus -dm_coord_space 0 -dm_coord_petscspace_degree 3 -dm_refine 1 -dm_view cgns:test.cgns
>
> and load it using Paraview,
>
> the mesh is still with straight lines.

Ah, the viewer is keyed on the field (since the CGNS as supported by Paraview specifies coordinates and fields in the same space). That doesn't exist in your case. If you apply this patch and add `-petscspace_degre 3` to your command, you'll see that high order information is present. Paraview doesn't render as curves in all views, but it has the data.

diff --git i/src/dm/impls/plex/tests/ex33.c w/src/dm/impls/plex/tests/ex33.c
index 803095bc082..590facfa4f4 100644
--- i/src/dm/impls/plex/tests/ex33.c
+++ w/src/dm/impls/plex/tests/ex33.c
@@ -198,7 +198,6 @@ PetscErrorCode CreateMesh(MPI_Comm comm, AppCtx *ctx, DM *dm)
   default:
     SETERRQ(comm, PETSC_ERR_ARG_OUTOFRANGE, "Unknown mesh transform %d", ctx->meshTransform);
   }
-  PetscCall(DMViewFromOptions(*dm, NULL, "-dm_view"));
   PetscFunctionReturn(PETSC_SUCCESS);
 }
 
@@ -227,6 +226,7 @@ static PetscErrorCode CreateDiscretization(DM dm, AppCtx *ctx)
   PetscCall(DMCreateDS(dm));
   PetscCall(DMGetDS(dm, &ds));
   PetscCall(PetscDSSetObjective(ds, 0, volume));
+  PetscCall(DMViewFromOptions(dm, NULL, "-dm_view"));
   PetscFunctionReturn(PETSC_SUCCESS);
 }
 

I can update the viewer to handle the degenerate case of no field (all my models have fields).


More information about the petsc-users mailing list