An 88-line MATLAB code for the parameterized level set method based topology optimization using radial basis functions

  • Peng Wei
  • Zuyu Li
  • Xueping Li
  • Michael Yu Wang


This paper presents a compact and efficient 88-line MATLAB code for the parameterized level set method based topology optimization using radial basis functions (RBFs), which is applied to minimize the compliance of a two-dimensional linear elastic structure. This parameterized level set method using radial basis functions can maintain a relatively smooth level set function with an approximate re-initialization scheme during the optimization process. It also has less dependency on initial designs due to its capability in nucleation of new holes inside the material domain. The MATLAB code and simple modifications are explained in detail with numerical examples. The 88-line code included in the appendix is intended for educational purposes.


Topology optimization Level set method Radial basis functions MATLAB code 



This research was supported by the National Natural Science Foundation of China under Grant Nos. 11372004, 11002056, 11002058 and the State Key Laboratory of Subtropical Building Science under Grant No. 2016 KB13.

Supplementary material

158_2018_1904_MOESM1_ESM.m (6 kb)
ESM 1 (M 5.82 kb)


  1. Allaire G (2009) A 2-d Scilab Code for shape and topology optimization by the level set method.∼allaire/levelset_en.html
  2. Allaire G, Jouve F, Toader AM (2004) Structural optimization using sensitivity analysis and a level-set method. J Comput Phys 194(1):363–393MathSciNetCrossRefMATHGoogle Scholar
  3. Allaire G, De Gournay F, Jouve F, Toader AM (2005) Structural optimization using topological and shape sensitivity via a level set method. Control Cybern 34(1):59–80MathSciNetMATHGoogle Scholar
  4. Andreassen E, Clausen A, Schevenels M, Lazarov BS, Sigmund O (2011) Efficient topology optimization in MATLAB using 88 lines of code. Struct Multidiscip Optim 43(1):1–16CrossRefMATHGoogle Scholar
  5. Bendsøe M, Sigmund O (2003) Topology optimization. Theory, methods and applications. Springer, BerlinMATHGoogle Scholar
  6. Burger M, Osher SJ (2005) A survey on level set methods for inverse problems and optimal design. Eur J Appl Math 16(2):263–301MathSciNetCrossRefMATHGoogle Scholar
  7. Burger M, Hackl B, Ring W (2004) Incorporating topological derivatives into level set methods. J Comput Phys 194(1):344–362MathSciNetCrossRefMATHGoogle Scholar
  8. Cecil T, Qian J, Osher S (2004) Numerical methods for high dimensional Hamilton-Jacobi equations using radial basis functions. J Comput Phys 196(1):327–347MathSciNetCrossRefMATHGoogle Scholar
  9. Challis VJ (2010) A discrete level-set topology optimization code written in MATLAB. Struct Multidiscip Optim 41(3):453–464MathSciNetCrossRefMATHGoogle Scholar
  10. Chan TF, Vese LA (2001) Active contours without edges. IEEE Trans Image Process 10(2):266–277CrossRefMATHGoogle Scholar
  11. Choi KK, Kim NH (2005) Structural sensitivity analysis and optimization 1. Springer, BerlinGoogle Scholar
  12. Deaton JD, Grandhi RV (2014) A survey of structural and multidisciplinary continuum topology optimization: post 2000. Struct Multidiscip Optim 49(1):1–38MathSciNetCrossRefGoogle Scholar
  13. Dijk NPV, Maute K, Langelaar M, van Keulen F (2013) Level-set methods for structural topology optimization: a review. Struct Multidiscip Optim 48(3):437–472MathSciNetCrossRefGoogle Scholar
  14. Emre B, To AC (2015) Proportional topology optimization: a new non-sensitivity method for solving stress constrained and minimum compliance problems and its implementation in MATLAB. PLoS One 10(12):e0145041CrossRefGoogle Scholar
  15. Gain AL, Paulino GH (2013) A critical comparative assessment of differential equation-driven methods for structural topology optimization. Struct Multidiscip Optim 48(4):685–710MathSciNetCrossRefGoogle Scholar
  16. Huang X, Xie YM (2010) Evolutionary Topology Optimization of Continuum Structures: Methods and Applications. Wiley, New YorkCrossRefMATHGoogle Scholar
  17. Kansa EJ, Power H, Fasshauer GE, Ling L (2004) A volumetric integral radial basis function method for time-dependent partial differential equations. I. Formulation. Eng Anal Bound Elem 28(10):1191–1206CrossRefMATHGoogle Scholar
  18. Kharmanda G, Olhoff N, Mohamed A, Lemaire M (2004) Reliability-based topology optimization. Struct Multidiscip Optim 26(5):295–307CrossRefGoogle Scholar
  19. Liu K, Tovar A (2014) An efficient 3d topology optimization code written in MATLAB. Struct Multidiscip Optim 50(6):1175–1196MathSciNetCrossRefGoogle Scholar
  20. Mei Y, Wang X (2004) A level set method for structural topology optimization and its applications. Adv Eng Softw 35(7):415–441CrossRefMATHGoogle Scholar
  21. Morse BS, Yoo TS, Chen DT, Rheingans P, Subramanian KR (2001) Interpolating implicit surfaces from scattered surface data using compactly supported radial basis functions. Int Conf Shape Model Appl 15(2):89–98CrossRefGoogle Scholar
  22. Olesen LH, Okkels F, Bruus H (2006) A high-level programming-language implementation of topology optimization applied to steady-state navier-stokes flow. Int J Numer Methods Eng 65(7):975–1001MathSciNetCrossRefMATHGoogle Scholar
  23. Osher S, Fedkiw R (2002) Level set methods and dynamic implicit surfaces. Springer, New YorkMATHGoogle Scholar
  24. Osher S, Santosa F (2001) Level set methods for optimization problems involving geometry and constraints: i. Frequencies of a two-density inhomogeneous drum. J Comput Phys 171(1):272–288MathSciNetCrossRefMATHGoogle Scholar
  25. Osher S, Sethian JA (1988) Fronts propagating with curvature-dependent speed: algorithms based on HamiltonJacobi formulations. J Comput Phys 79(1):12–49MathSciNetCrossRefMATHGoogle Scholar
  26. Otomori M, Yamada T, Izui K, Nishiwaki S (2014) MATLAB code for a level set-based topology optimization method using a reaction diffusion equation. Struct Multidiscip Optim 51(5):1159–1172MathSciNetCrossRefGoogle Scholar
  27. Peng D, Merriman B, Osher S, Zhao H.& Kang M. (1999) A PDE-based fast local level set method. J Comput Phys 155(2):410–438MathSciNetCrossRefMATHGoogle Scholar
  28. Rochafellar RT (1973) The multiplier method of Hestenes and Powell applied to convex programming. J Optim Theory Appl 12:555–562MathSciNetCrossRefGoogle Scholar
  29. Schmidt S, Schulz V (2011) A 2589 line topology optimization code written for the graphics card. Comput Vis Sci 14(6):249–256MathSciNetCrossRefMATHGoogle Scholar
  30. Sethian JA (1999) Level set methods and fast marching methods: evolving interfaces in computational geometry, fluid mechanics, computer vision, and materials science. Cambridge University Press, CambridgeMATHGoogle Scholar
  31. Sethian JA, Wiegmann A (2000) Structural boundary design via level set and immersed interface methods. J Comput Phys 163(2):489–528MathSciNetCrossRefMATHGoogle Scholar
  32. Sigmund O (2001) A 99 line topology optimization code written in MATLAB. Struct Multidiscip Optim 21(21):120–127CrossRefGoogle Scholar
  33. Sigmund O, Maute K (2013) Topology optimization approaches. Struct Multidiscip Optim 48(6):1031–1055MathSciNetCrossRefGoogle Scholar
  34. Sokołowski J, Żochowski A (1999) On the topological derivative in shape optimization. SIAM J Control Optim 37(4):1251–1272MathSciNetCrossRefMATHGoogle Scholar
  35. Sokołowski J, Zolésio JP (1992) Introduction to shape optimization: shape Sensitity analysis. Introduction to shape optimization : shape sensitivity analysis. Springer-Verlag, BerlinMATHGoogle Scholar
  36. Suresh K (2010) A 199-line MATLAB code for Pareto-optimal tracing in topology optimization. Struct Multidiscip Optim 42(5):665–679MathSciNetCrossRefMATHGoogle Scholar
  37. Talischi C, Paulino GH, Pereira A, Menezes IFM (2012) Polytop: a MATLAB implementation of a general topology optimization framework using unstructured polygonal finite element meshes. Struct Multidiscip Optim 45(3):329–357MathSciNetCrossRefMATHGoogle Scholar
  38. Tavakoli R, Mohseni SM (2014) Alternating active-phase algorithm for multimaterial topology optimization problems: a 115-line MATLAB implementation. Struct Multidiscip Optim 49(4):621–642MathSciNetCrossRefGoogle Scholar
  39. Van Dijk NP, Maute K, Langelaar M, Van Keulen F (2013) Level-set methods for structural topology optimization: a review. Struct Multidiscip Optim 48(3):437–472MathSciNetCrossRefGoogle Scholar
  40. Wang SY, Wang MY (2006a) Radial basis functions and level set method for structural topology optimization. Int J Numer Meth Engng 65:2060–2090MathSciNetCrossRefMATHGoogle Scholar
  41. Wang SY, Wang MY (2006b) Structural shape and topology optimization using an implicit free boundary parameterization method. Comput Model Eng Sci 13(2):119–147MathSciNetMATHGoogle Scholar
  42. Wang MY, Wei P (2005) Topology optimization with level set method incorporating topological derivative. 6th World Congress on Structural & Multidisciplinary Optimization, Rio de Janeiro, BrazilGoogle Scholar
  43. Wang MY, Wang X, Guo D (2003) A level set method for structural topology optimization. Comput Methods Appl Mech Eng 192(1–2):227–246MathSciNetCrossRefMATHGoogle Scholar
  44. Wang MY, Chen SK, Xia Q (2004) TOPLSM, 199-line version.
  45. Wang SY, Lim KM, Khoo BC, Wang MY (2007) An extended level set method for shape and topology optimization. J Comput Phys 221(1):395–421MathSciNetCrossRefMATHGoogle Scholar
  46. Wei P, Wang MY (2006) The augmented Lagrangian method in structural shape and topology optimization with RBF based level set method, The 4th China-Japan-Korea Joint Symposium on Optimization of Structural and Mechanical Systems, Kunming, ChinaGoogle Scholar
  47. Wei P, Wang MY (2009) Piecewise constant level set method for structural topology optimization. Int J Numer Methods Eng 78(4):379–402MathSciNetCrossRefMATHGoogle Scholar
  48. Wendland H (1995) Piecewise polynomial, positive definite and compactly supported radial functions of minimal degree. Adv Comput Math 4(1):389–396MathSciNetCrossRefMATHGoogle Scholar
  49. Xia L, Breitkopf P (2015) Design of materials using topology optimization and energy-based homogenization approach in MATLAB. Struct Multidiscip Optim 52(6):1229–1241MathSciNetCrossRefGoogle Scholar
  50. Xie X, Mirmehdi M (2011) Radial basis function based level set interpolation and evolution for deformable modelling. Image Vis Comput 29(2–3):167–177CrossRefGoogle Scholar
  51. Yamada T, Izui K, Nishiwaki S, Takezawa A (2010) A topology optimization method based on the level set method incorporating a fictitious interface energy. Comput Methods Appl Mech Eng 199(45–48):2876–2891MathSciNetCrossRefMATHGoogle Scholar
  52. Zegard T, Paulino GH (2015) GRAND3 - ground structure based topology optimization for arbitrary 3D domains using MATLAB. Struct Multidiscip Optim 52(6):1161–1184CrossRefGoogle Scholar
  53. Zhang W, Yuan J, Zhang J, Guo X (2016) A new topology optimization approach based on moving Morphable components (MMC) and the ersatz material model. Struct Multidiscip Optim 53(6):1243–1260MathSciNetCrossRefGoogle Scholar
  54. Zhao HK, Chan T, Merriman B, Osher S (1996) A variational level set approach to multiphase motion. J Comput Phys 127:179–195MathSciNetCrossRefMATHGoogle Scholar
  55. Zhou S, Cadman J, Chen Y, Li W, Xie YM, Huang X et al (2012) Design and fabrication of biphasic cellular materials with transport properties – a modified bidirectional evolutionary structural optimization procedure and MATLAB program. Int J Heat Mass Transf 55(25–26):8149–8162CrossRefGoogle Scholar
  56. Zuo ZH, Xie YM (2015) A simple and compact python code for complex 3D topology optimization. Adv Eng Softw 85:1–11CrossRefGoogle Scholar

Copyright information

© Springer-Verlag GmbH Germany, part of Springer Nature 2018

Authors and Affiliations

  1. 1.State Key Laboratory of Subtropical Building Science, School of Civil Engineering and TransportationSouth China University of TechnologyGuangzhouChina
  2. 2.Architecture and Civil Engineering InstituteGuangdong University of Petrochemical TechnologyMaomingChina
  3. 3.Department of Mechanical and Aerospace EngineeringHong Kong University of Science and TechnologyHong KongChina

Personalised recommendations