[petsc-users] Questitons about viewing the mesh from "Meshing for Subsurface Flows in PETSc"

neil liu liufield at gmail.com
Sat Sep 7 21:28:17 CDT 2024


Dear Petsc developers,

I am trying to learn about the mesh refinement part.
I tried to follow the instructions from the website, "Meshing for
Subsurface Flows in PETSc,
make -f ./gmakefile test globsearch="dm_impls_plex_tutorials-ex10_0",
but it will run many tests and will not deliver "

DM <https://urldefense.us/v3/__https://petsc.org/release/manualpages/DM/DM/__;!!G_uCfscf7eWS!aTuEZNwxZ2ve5zOYEu5SDetjZlPcfc2PSiSmVCUcExxOERlForddvBHJQsxjVbpj-Nj9CGeSJ_mMEQGBDsVPPQ$ > Object: Mesh 1 MPI
process  type: plexMesh in 3 dimensions:  Number of 0-cells per rank:
8  Number of 1-cells per rank: 14 (4)  Number of 2-cells per rank: 9
(5)  Number of 3-cells per rank: 2Labels:  celltype: 6 strata with
value/size (3 (4), 9 (2), 0 (8), 2 (4), 1 (10), 5 (5))  depth: 4
strata with value/size (0 (8), 1 (14), 2 (9), 3 (2))  marker: 1 strata
with value/size (1 (24))  Face Sets: 1 strata with value/size (1 (12))

"
While it is successful if I go to the directory for ex10 and make ex10
there and run with options there. DId I miss something?

In addition, in order t view the mesh, I added the following lines to
ex10.c,

// Create HDF5 viewer
PetscViewer viewer;
const char *filename = "mesh.h5"; // Output file
PetscViewerCreate(PETSC_COMM_WORLD, &viewer);
PetscViewerSetType(viewer, PETSCVIEWERHDF5);
PetscViewerFileSetMode(viewer, FILE_MODE_WRITE);
PetscViewerFileSetName(viewer, filename);

// Optionally set the name of the DM object if you are saving multiple
meshes
PetscObjectSetName((PetscObject)dm, "MyMeshName");

// Save DM to HDF5 file
DMView(dm, viewer);

This wil genearte a .h5 file. Then I run
petsc-with-docs-3.21.1/petsc-3.21.1/lib/petsc/bin/petsc_gen_xdmf.py mesh.h5

This gave a .xml file. I tried to load this xml file into paraview using
xdmf reader. But it was not successful. Did I miss something ?

Thanks a lot,

Xiaodong
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20240907/ece90c18/attachment.html>


More information about the petsc-users mailing list