[petsc-users] dmplex, triangle and generating unstructured mesh

Nicolas Barral nicolas.barral at math.u-bordeaux.fr
Mon Jun 16 06:37:36 CDT 2025


On 14/06/2025 18:45, Steven Dargaville wrote:
> Hi, I'm just wondering if it is possible to generate a simple 
> unstructured mesh in 2D with DMPlex and one of the external generators, 
> like triangle?
> 
> I'm running snes/tutorials/ex20 which uses triangle and I can only seem 
> to generate structured triangular meshes. It is a simple 2D box so it 
> makes sense a Delaunay might output a structured mesh in that case. I 
> know I could get the DM to read in an unstructured mesh from a file that 
> I have previously generated, but for ease I'm wondering if this can be 
> done directly.
> 
> I've tried a few different things to try and force an unstructured mesh 
> being generated, like changing the number of faces to 1 (- 
> dm_plex_box_faces 1,1) so it only sees the corners of the box domain.
> 
> I've also tried to set some of the options to triangle with 
> DMPlexTriangleSetOptions but that doesn't seem to have any effect, so 
> I'm guessing I'm potentially not using it correctly (and I can't seem to 
> find any examples that use this function to help).
> 
> Anyone have any suggestions? Thanks for your help

I don't know how the mesh is generated, but a workaround would be to 
generate a coarse mesh then use the adaptive remeshing functions (e.g. 
with MMG) - with a uniform metric if you want a uniform mesh. 
plex/tests/ex19 should show how it works.

Thanks

-- 
Nicolas
> Steven



More information about the petsc-users mailing list