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

neil liu liufield at gmail.com
Sun Sep 8 03:37:27 CDT 2024


I tried vtk format by modifying the line as follows.
PetscViewerSetType(viewer, PETSCVIEWERVTK);
The resulting vtk file can be loaded into Paraview.
But the mesh is different from the website.
With
./ex10 -init_dm_plex_dim 2 -init_dm_plex_box_faces 5,5 -dm_extrude 10, the
mesh is ,
[image: Screenshot from 2024-09-08 04-34-35.png]
WIth adapt,
./ex10 -init_dm_plex_dim 2 -init_dm_plex_box_faces 5,5 -adapt
-volume_constraint_1 0.01 -volume_constraint_2 0.000625
 -dm_extrude 10
[image: Screenshot from 2024-09-08 04-35-45.png]
The refined mesh is quite different from the website,
[image: Screenshot from 2024-09-08 04-36-46.png]
Did I miss something?

Thanks a lot,

Xiaodong







On Sat, Sep 7, 2024 at 10:28 PM neil liu <liufield at gmail.com> wrote:

> 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!fEB4awHydwk05afkf23E0BBU-hsKQ64jWyjFeLeutob8dtqAaoG5vm2YhFycJT68ayRrurMOqg6goMZ2LrMu6Q$ > 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/20240908/ae08369a/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screenshot from 2024-09-08 04-34-35.png
Type: image/png
Size: 193783 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20240908/ae08369a/attachment-0003.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screenshot from 2024-09-08 04-35-45.png
Type: image/png
Size: 1000034 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20240908/ae08369a/attachment-0004.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screenshot from 2024-09-08 04-36-46.png
Type: image/png
Size: 926443 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20240908/ae08369a/attachment-0005.png>


More information about the petsc-users mailing list