Skip to main content
Log in

PolyMesher: a general-purpose mesh generator for polygonal elements written in Matlab

Structural and Multidisciplinary Optimization Aims and scope Submit manuscript

Abstract

We present a simple and robust Matlab code for polygonal mesh generation that relies on an implicit description of the domain geometry. The mesh generator can provide, among other things, the input needed for finite element and optimization codes that use linear convex polygons. In topology optimization, polygonal discretizations have been shown not to be susceptible to numerical instabilities such as checkerboard patterns in contrast to lower order triangular and quadrilaterial meshes. Also, the use of polygonal elements makes possible meshing of complicated geometries with a self-contained Matlab code. The main ingredients of the present mesh generator are the implicit description of the domain and the centroidal Voronoi diagrams used for its discretization. The signed distance function provides all the essential information about the domain geometry and offers great flexibility to construct a large class of domains via algebraic expressions. Examples are provided to illustrate the capabilities of the code, which is compact and has fewer than 135 lines.

This is a preview of subscription content, log in via an institution to check access.

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Institutional subscriptions

Fig. 1
Fig. 2
Fig. 3
Fig. 4
Fig. 5
Fig. 6
Fig. 7
Fig. 8
Fig. 9
Fig. 10
Fig. 11
Fig. 12
Fig. 13
Fig. 14
Fig. 15
Fig. 16

Similar content being viewed by others

Notes

  1. For example, consider \(\Omega_{1}=\left\{ \left(x_{1},x_{2}\right)\in\mathbb{R}^{2}:x_{1}<0\right\} \) and \(\Omega_{2}=\left\{ \left(x_{1},x_{2}\right)\in\mathbb{R}^{2}:x_{2}<0\right\} \). The formula \(d_{\Omega_{1}\cup\Omega_{2}}(\mathbf{x})=\min\left(d_{\Omega_{1}}(\mathbf{x}),d_{\Omega_{2}}(\mathbf{x})\right)\) has incorrect distance “value” in the third quadrant, i.e., for x 1 < 0, x 2 < 0. In this region, the closest boundary point is the new corner x = (0, 0) formed by the union operation.

  2. A tessellation or tiling of Δ is a collection of open sets S i such that \(\cup_{i}\overline{S}_{i}=\overline{\Delta}\) and S i  ∩ S j  = ∅ if i ≠ j.

  3. The cell structure allows for storing vectors of different size and is therefore suitable for connectivity of polygonal elements with different number of nodes.

  4. This small overhead can be removed after a few iterations once a good estimate value is obtained.

  5. Since the gradation in mesh is often dictated by the geometry of the domain, it is natural that both μ and h be defined based on the distance function d Ω.

References

  • Allaire G, Jouve F (2005) A level-set method for vibration and multiple loads structural optimization. Comput Methods Appl Mech Eng 194(30–33):3269–3290. doi:10.1016/j.cma.2004.12.018

    Article  MathSciNet  MATH  Google Scholar 

  • Allaire G, Pantz O (2006) Structural optimization with FreeFem+ +. Struct Multidisc Optim 32(3):173–181. doi:10.1007/s00158-006-0017-y

    Article  MathSciNet  Google Scholar 

  • Andreassen E, Clausen A, Schevenels M, Lazarov B, Sigmund O (2011) Efficient topology optimization in MATLAB using 88 lines of code. Struct Multidisc Optim 43(1):1–16. doi:10.1007/s00158-010-0594-7

    Google Scholar 

  • Aurenhammer F (1991) Voronoi diagrams—a survey of a fundamental geometric data structure. ACM Comput Surv 23(3):345–405

    Article  Google Scholar 

  • Bolander JE, Saito S (1998) Fracture analyses using spring networks with random geometry. Eng Fract Mech 61(5–6):569–591. doi:10.1016/S0013-7944(98)00069-1

    Article  Google Scholar 

  • Challis VJ (2010) A discrete level-set topology optimization code written in matlab. Struct Multidisc Optim 41(3):453–464. doi:10.1007/s00158-009-0430-0

    Article  MathSciNet  Google Scholar 

  • Cuthill E, McKee J (1969) Reducing the bandwidth of sparse symmetric matrices. In: Proceedings of the 24th national conference. ACM Press, New York, NY, pp 157–172. doi:10.1145/800195.805928

    Chapter  Google Scholar 

  • Du Q, Gunzburger M (2002) Grid generation and optimization based on centroidal Voronoi tessellations. Appl Math Comput 133(2–3):591–607. doi:10.1016/S0096-3003(01)00260-0

    Article  MathSciNet  MATH  Google Scholar 

  • Du Q, Wang DS (2005) The optimal centroidal Voronoi tessellations and the Gersho’s conjecture in the three-dimensional space. Comput Math Appl 49(9–10):1355–1373

    Article  MathSciNet  MATH  Google Scholar 

  • Du Q, Faber V, Gunzburger M (1999) Centroidal Voronoi tessellations: applications and algorithms. Siam Rev 41(4):637–676

    Article  MathSciNet  MATH  Google Scholar 

  • Du Q, Gunzburger M, Ju L (2003) Constrained centroidal Voronoi tessellations for surfaces. Siam J Sci Comput 24(5):1488–1506

    Article  MathSciNet  MATH  Google Scholar 

  • Du Q, Emelianenko M, Ju LL (2006) Convergence of the Lloyd algorithm for computing centroidal Voronoi tessellations. Siam J Numer Anal 44(1):102–119. doi:10.1137/040617364

    Article  MathSciNet  Google Scholar 

  • Huang Y, Qin H, Wang D (2008) Centroidal Voronoi tessellation-based finite element superconvergence. Int J Numer Methods Eng 76(12):1819–1839. doi:10.1002/nme.2374

    Article  MathSciNet  MATH  Google Scholar 

  • Ju L, Gunzburger M, Zhao W (2006) Adaptive finite element methods for elliptic PDEs based on conforming centroidal Voronoi-Delaunay triangulations. Siam J Sci Comput 28(6):2023–2053

    Article  MathSciNet  MATH  Google Scholar 

  • Langelaar M (2007) The use of convex uniform honeycomb tessellations in structural topology optimization. In: 7th world congress on structural and multidisciplinary optimization, Seoul, South Korea, 21–25 May 2007

  • Liu Y, Wang W, Levy B, Sun F, Yan D, Lu L, Yang C (2009) On centroidal Voronoi tesselleations–energy smoothness and fast computation. ACM Trans Graph 28(4):101:1–17

    Google Scholar 

  • Liu Z, Korvink JG, Huang R (2005) Structure topology optimization: fully coupled level set method via FEMLAB. Struct Multidisc Optim 29:407–417

    Article  MathSciNet  Google Scholar 

  • Osher S, Fedkiw R (2003) Level set methods and dynamic implicit surfaces. Applied mathematical sciences, vol 153. Springer-Verlag, New York

    MATH  Google Scholar 

  • Paulino GH, Menezes IFM, Gattass M, Mukherjee S (1994a) Node and element resequencing using the laplacian of a finite element graph: part I—general concepts and algorithm. Int J Numer Methods Eng 37(9):1511–1530. doi:10.1002/nme.1620370907

    Article  MATH  Google Scholar 

  • Paulino GH, Menezes IFM, Gattass M, Mukherjee S (1994b) Node and element resequencing using the laplacian of a finite element graph: part II—implementation and numerical results. Int J Numer Methods Eng 37(9):1531–1555. doi:10.1002/nme.1620370908

    Article  Google Scholar 

  • Persson P (2006) Mesh size functions for implicit geometries and PDE-based gradient limiting. Eng Comput 22(2):95–109

    Article  Google Scholar 

  • Persson P, Strang G (2004) A simple mesh generator in MATLAB. Siam Rev 46(2):329–345

    Article  MathSciNet  MATH  Google Scholar 

  • Raghavan P, Li S, Ghosh S (2004) Two scale response and damage modeling of composite materials. Finite Elem Anal Des 40(12):1619–1640

    Article  Google Scholar 

  • Ricci A (1973) A constructive geometry for computer graphics. Comput J 16(2):157–160

    Article  MATH  Google Scholar 

  • Saxena A (2008) A material-mask overlay strategy for continuum topology optimization of compliant mechanisms using honeycomb discretization. J Mech Des 130(8):082304. doi:10.1115/1.2936891

    Article  Google Scholar 

  • Sethian JA (1999) Fast marching methods. Siam Rev 41(2):199–235

    Article  MathSciNet  MATH  Google Scholar 

  • Sieger D, Alliez P, Botsch M (2010) Optimizing Voronoi diagrams for polygonal finite element computations. In: Proceedings of the 19th international meshing roundtable

  • Sigmund O (2001) A 99 line topology optimization code written in Matlab. Struct Multidisc Optim 21(2):120–127

    Article  Google Scholar 

  • Sukumar N, Malsch EA (2006) Recent advances in the construction of polygonal finite element interpolants. Arch Comput Methods Eng 13(1):129–163

    Article  MathSciNet  MATH  Google Scholar 

  • Sukumar N, Tabarraei A (2004) Conforming polygonal finite elements. Int J Numer Methods Eng 61(12):2045–2066. doi:10.1002/nme.1141

    Article  MathSciNet  MATH  Google Scholar 

  • Suresh K (2010) A 199-line matlab code for Pareto-optimal tracing in topology optimization. Struct Multidisc Optim 42(5):665–679. doi:10.1007/s00158-010-0534-6

    Article  MathSciNet  Google Scholar 

  • Sussman M, Fatemi E, Smereka P, Osher S (1998) An improved level set method for incompressible two-phase flows. Comput Fluids 27(5–6):663–680

    Article  MATH  Google Scholar 

  • Talischi C, Paulino GH, Le CH (2009) Honeycomb Wachspress finite elements for structural topology optimization. Struct Multidisc Optim 37(6):569–583. doi:10.1007/s00158-008-0261-4

    Article  MathSciNet  Google Scholar 

  • Talischi C, Paulino GH, Pereira A, Menezes IFM (2010) Polygonal finite elements for topology optimization: a unifying paradigm. Int J Numer Methods Eng 82(6):671–698. doi:10.1002/nme.2763

    MATH  Google Scholar 

  • Talischi C, Paulino GH, Pereira A, Menezes IFM (2011) PolyTop: a Matlab implementation of a general topology optimization framework using unstructured polygonal finite element meshes. doi:10.1007/s00158-011-0696-x

  • Yip M, Mohle J, Bolander JE (2005) Automated modeling of three-dimensional structural components using irregular lattices. Comput-aided Civil Infrastruct Eng 20(6):393–407. doi:10.1111/j.1467-8667.2005.00407.x

    Article  Google Scholar 

  • Zhao H (2004) A fast sweeping method for Eikonal equations. Math Comput 74(250):603–627

    Article  Google Scholar 

Download references

Acknowledgements

The first and second authors acknowledge the support by the Department of Energy Computational Science Graduate Fellowship Program of the Office of Science and National Nuclear Security Administration in the Department of Energy under contract DE-FG02-97ER25308. The third and last authors acknowledge the financial support by Tecgraf (Group of Technology in Computer Graphics), PUC-Rio, Rio de Janeiro, Brazil. The authors also acknowledge the insightful comments of the two anonymous reviewers which contributed to improving the manuscript further.

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Glaucio H. Paulino.

Electronic Supplementary Material

Below is the link to the electronic supplementary material.

(ZIP 11.6 KB)

Appendices

Appendix A: PolyMesher

Appendix B: Library of distance functions

Rights and permissions

Reprints and permissions

About this article

Cite this article

Talischi, C., Paulino, G.H., Pereira, A. et al. PolyMesher: a general-purpose mesh generator for polygonal elements written in Matlab. Struct Multidisc Optim 45, 309–328 (2012). https://doi.org/10.1007/s00158-011-0706-z

Download citation

  • Received:

  • Revised:

  • Accepted:

  • Published:

  • Issue Date:

  • DOI: https://doi.org/10.1007/s00158-011-0706-z

Keywords

Navigation