Unstructured Matlab 2D Mesh and Grid Generation using Triangle

Unstructured Matlab 2D Mesh and Grid Generation using Triangle

11–13 minutes

This update fully integrates J.R. Shewchuk’s fast and efficient 2D mesh and grid generator Triangle with FEATool [1][2][3]. Both Matlab and Octave command line interface (CLI) usage is supported with the gridgen_triangle function, as well as FEATool GUI usage with the new dedicated Tri button available in 2D grid mode.

Advantages of using Triangle compared to the built-in (DistMesh based) grid generation function is firstly the overall speed, as it is one of the fastest 2D unstructured mesh generators available (completely written in C code). Moreover, Triangle also supports control for specifying the grid size in different subdomains and geometry regions, as well as on boundaries, allowing for greater flexibility and higher quality grids adapted to specific problems and geometries.

To evaluate the performance of Triangle and compare it to the built-in DistMesh based grid generator a simple benchmark test case was employed. The test case consisted of generating a uniform mesh for a unit circle with average grid sizes hmax = [0.1 0.05 0.025 0.0125 0.00625]. The normalized timings for using gridgen

tic
geom.objects = { gobj_circle() };
grid = gridgen( geom, 'hmax', hmax );
t = toc

to mesh the circle in Matlab and Octave, as well as the new gridgen_triangle function are plotted as log scale curves in the figure below.

The results show that for the finest grid (hmax = 0.00625, consisting of approximately 185000 triangles) required 10 seconds for Triangle, 1 minute for DistMesh and Matlab, and close to 7 minutes for Octave (suffering from lack of Just-In-Time JIT compilation). Also note that the Triangle timings also includes time taken for IO export and import, that is the total time the user might typically see. Thus it is clear that Triangle can offer magnitudes of speed improvements for two-dimensional unstructured grid generation.

Please visit http://www.featool.com/grid/2017/09/14/Unstructured-Matlab-Mesh-Generation-with-Triangle.html for more information, download, and examples.

References

[1] The Triangle Mesh Generator home page (https://www.cs.cmu.edu/~quake/triangle.html).

[2] J.R. Shewchuk, Triangle: Engineering a 2D Quality Mesh Generator and Delaunay Triangulator, in Applied Computational Geometry: Towards Geometric Engineering (Ming C. Lin and Dinesh Manocha, editors), volume 1148 of Lecture Notes in Computer Science, pages 203–222, Springer-Verlag, Berlin, May 1996. (From the First ACM Workshop on Applied Computational Geometry).

[3] J.R. Shewchuk, Delaunay Refinement Algorithms for Triangular Mesh Generation, Computational Geometry: Theory and Applications 22(1–3):21–74, May 2002.


Originally published at www.featool.com on September 14, 2017.