Skip to main content
Log in

MATLAB implementations of velocity field level set method for topology optimization: an 80-line code for 2D and a 100-line code for 3D problems

  • Educational Paper
  • Published:
Structural and Multidisciplinary Optimization Aims and scope Submit manuscript

Abstract

This paper presents MATLAB implementations of the velocity field level set method for topology optimization. An 80-line code and a 100-line code are provided for 2D and 3D static compliance minimization problems, respectively. The velocity field level set method inherits the implicit topology and shape representation of the standard level set method but advances the design boundaries with a velocity field constructed from the velocity design variables and basis functions. Therefore, it can achieve structural designs with relatively clear and smooth material boundaries. Moreover, it allows general mathematical programming algorithms to be conveniently employed to handle more constraints when solving the optimization problem. In the presented codes, the method of moving asymptotes is used as the optimizer. For simplification, the presented MATLAB code is in a basic version. Some modifications and extensions are given in the examples to show the validity and efficiency of the codes. Further adaption of the current codes can also be made to fulfill various requirements.

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.

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
Fig. 17
Fig. 18

References

  • Allaire G (2009) A 2-d Scilab Code for shape and topology optimization by the level set method. In: http://www.cmap.polytechnique.fr/~allaire/levelset_en.html. Accessed December 2020

  • Allaire G, Dapogny C, Estevez R, Faure A, Michailidis G (2017) Structural optimization under overhang constraints imposed by additive manufacturing technologies. J Comput Phys 351:295–328

    Article  MathSciNet  MATH  Google Scholar 

  • 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:59–81

    MathSciNet  MATH  Google Scholar 

  • Allaire G, Jouve F, Toader AM (2004) Structural optimization using sensitivity analysis and a level-set method. J Comput Phys 194:363–393

    Article  MathSciNet  MATH  Google Scholar 

  • 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–16

    Article  MATH  Google Scholar 

  • Burger M, Hackl B, Ring W (2004) Incorporating topological derivatives into level set methods. J Comput Phys 194:344–362

    Article  MathSciNet  MATH  Google Scholar 

  • Challis VJ (2010) A discrete level-set topology optimization code written in Matlab. Struct Multidiscip Optim 41:453–464

    Article  MathSciNet  MATH  Google Scholar 

  • Coffin P, Maute K (2016) Level set topology optimization of cooling and heating devices using a simplified convection model. Struct Multidiscip Optim 53:985–1003

    Article  Google Scholar 

  • Deaton JD, Grandhi RV (2014) A survey of structural and multidisciplinary continuum topology optimization: post 2000. Struct Multidiscip Optim 49:1–38

    Article  MathSciNet  Google Scholar 

  • Dilgen CB, Dilgen SB, Aage N, Jensen JS (2019) Topology optimization of acoustic mechanical interaction problems: a comparative review. Struct Multidiscip Optim 60:779–801

    Article  MathSciNet  Google Scholar 

  • Dunning PD, Kim HA (2015) Introducing the sequential linear programming level-set method for topology optimization. Struct Multidiscip Optim 51:631–643

    Article  MathSciNet  Google Scholar 

  • Ferrari F, Sigmund O (2020) A new generation 99 line Matlab code for compliance topology optimization and its extension to 3D. Struct Multidiscip Optim 62:2211–2228

    Article  MathSciNet  Google Scholar 

  • Gao J, Luo Z, Xia L, Gao L (2019) Concurrent topology optimization of multiscale composite structures in Matlab. Struct Multidiscip Optim 60:2621–2651

    Article  MathSciNet  Google Scholar 

  • Huang X, Xie YM (2010) Evolutionary topology optimization of continuum structures. John Wiley & Sons, Ltd, Chichester

    Book  MATH  Google Scholar 

  • Jiang L, Chen S, Jiao X (2018) Parametric shape and topology optimization: a new level set approach based on cardinal basis functions. Int J Numer Methods Eng 114:66–87

    Article  MathSciNet  Google Scholar 

  • Kreissl S, Pingen G, Maute K (2011) An explicit level set approach for generalized shape optimization of fluids with the lattice Boltzmann method. Int J Numer Methods Fluids 65:496–519

    Article  MATH  Google Scholar 

  • Laurain A (2018) A level set-based structural optimization code using FEniCS. Struct Multidiscip Optim 58:1311–1334

    Article  MathSciNet  Google Scholar 

  • Liu H, Tian Y, Zong H, Ma Q, Wang MY, Zhang L (2019) Fully parallel level set method for large-scale structural topology optimization. Comput Struct 221:13–27

    Article  Google Scholar 

  • Liu P, Luo Y, Kang Z (2016) Multi-material topology optimization considering interface behavior via XFEM and level set method. Comput Methods Appl Mech Eng 308:113–133

    Article  MathSciNet  MATH  Google Scholar 

  • Luo J, Luo Z, Chen L, Tong L, Yu M (2008a) A semi-implicit level set method for structural shape and topology optimization. J Comput Phys 227:5561–5581

    Article  MathSciNet  MATH  Google Scholar 

  • Luo Z, Tong L, Kang Z (2009a) A level set method for structural shape and topology optimization using radial basis functions. Comput Struct 87:425–434

    Article  Google Scholar 

  • Luo Z, Tong L, Luo J, Wei P, Yu M (2009b) Design of piezoelectric actuators using a multiphase level set method of piecewise constants. J Comput Phys 228:2643–2659

    Article  MathSciNet  MATH  Google Scholar 

  • Luo Z, Wang MY, Wang S, Wei P (2008b) A level set-based parameterization method for structural shape and topology optimization. Int J Numer Methods Eng 76:1–26

    Article  MathSciNet  MATH  Google Scholar 

  • Mei Y, Wang X (2004) A level set method for structural topology optimization and its applications. Adv Eng Softw 35:415–441

    Article  MATH  Google Scholar 

  • Osher S, Fedkiw R (2003) Level set method and dynamic implicit surfaces. Springer, Berlin

    Book  MATH  Google Scholar 

  • Otomori M, Yamada T, Izui K, Nishiwaki S (2015) Matlab code for a level set-based topology optimization method using a reaction diffusion equation. Struct Multidiscip Optim 51:1159–1172

    Article  MathSciNet  Google Scholar 

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

    Article  Google Scholar 

  • Sigmund O, Maute K (2013) Topology optimization approaches: a comparative review. Struct Multidiscip Optim 48:1031–1055

    Article  MathSciNet  Google Scholar 

  • Svanberg K (1987) The method of moving asymptotes-a new method for structural optimization. Int J Numer Methods Eng 24:359–373

    Article  MathSciNet  MATH  Google Scholar 

  • Takezawa A, Nishiwaki S, Kitamura M (2010) Shape and topology optimization based on the phase field method and sensitivity analysis. J Comput Phys 229:2697–2718

    Article  MathSciNet  MATH  Google Scholar 

  • van Dijk NP, Maute K, Langelaar M, van Keulen F (2013) Level-set methods for structural topology optimization: a review. Struct Multidiscip Optim 48:437–472

    Article  MathSciNet  Google Scholar 

  • Wang M, Chen S, Xia Q (2004) TOPLSM: 199-line version. In: http://ihome.ust.hk/~mywang/download/TOPLSM_199.m

  • Wang MY, Wang X, Guo D (2003) A level set method for structural topology optimization. Comput Methods Appl Mech Eng 192:227–246

    Article  MathSciNet  MATH  Google Scholar 

  • Wang Y, Gao J, Kang Z (2018) Level set-based topology optimization with overhang constraint: towards support-free additive manufacturing. Comput Methods Appl Mech Eng 339:591–614

    Article  MathSciNet  MATH  Google Scholar 

  • Wang Y, Kang Z (2018) A velocity field level set method for shape and topology optimization. Int J Numer Methods Eng 115:1315–1336

    Article  MathSciNet  Google Scholar 

  • Wang Y, Kang Z (2019) Concurrent two-scale topological design of multiple unit cells and structure using combined velocity field level set and density model. Comput Methods Appl Mech Eng 347:340–364

    Article  MathSciNet  MATH  Google Scholar 

  • Wang Y, Kang Z, Liu P (2019) Velocity field level-set method for topological shape optimization using freely distributed design variables. Int J Numer Methods Eng 120:1411–1427

    Article  MathSciNet  Google Scholar 

  • Wei P, Li Z, Li X, Wang MY (2018) An 88-line MATLAB code for the parameterized level set method based topology optimization using radial basis functions. Struct Multidiscip Optim 58:831–849

    Article  MathSciNet  Google Scholar 

  • Wei P, Yang Y, Chen S, Wang MY (2021) A study on basis functions of the parameterized level set method for topology optimization of continuums. J Mech Des 143(4):1–48

    Article  Google Scholar 

  • Xia Q, Shi T, Liu S, Wang MY (2012) A level set solution to the stress-based structural shape and topology optimization. Comput Struct 90–91:55–64

    Article  Google Scholar 

  • 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:2876–2891

    Article  MathSciNet  MATH  Google Scholar 

  • Ye Q, Guo Y, Chen S, Lei N, Gu XD (2019) Topology optimization of conformal structures on manifolds using extended level set methods (X-LSM) and conformal geometry theory. Comput Methods Appl Mech Eng 344:164–185

    Article  MathSciNet  MATH  Google Scholar 

  • Zuo ZH, Xie YM (2015) A simple and compact Python code for complex 3D topology optimization. Adv Eng Softw 85:1–11

    Article  Google Scholar 

Download references

Acknowledgements

The support of the National Science Foundation of China (12002076, 11872140) and China Postdoctoral Science Foundation (2019TQ0047) is gratefully acknowledged.

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Zhan Kang.

Ethics declarations

Conflict of interest

The authors declare that they have no conflict of interest.

Replication of results

The MATLAB codes are given in Appendices and can also be downloaded in the supplementary material. The MMA algorithm we use here is Version September 2007 (and a small change August 2008) developed by Professor Krister Svanberg (krille@math.kth.se).

Additional information

Responsible Editor: Zhen Luo

Publisher's note

Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Supplementary Information

ESM 1

(M 5 kb)

ESM 2

(M 6 kb)

Appendices

Appendix 1

figure l

Appendix 2

figure n

Rights and permissions

Reprints and permissions

About this article

Check for updates. Verify currency and authenticity via CrossMark

Cite this article

Wang, Y., Kang, Z. MATLAB implementations of velocity field level set method for topology optimization: an 80-line code for 2D and a 100-line code for 3D problems. Struct Multidisc Optim 64, 4325–4342 (2021). https://doi.org/10.1007/s00158-021-02958-4

Download citation

  • Received:

  • Revised:

  • Accepted:

  • Published:

  • Issue Date:

  • DOI: https://doi.org/10.1007/s00158-021-02958-4

Keywords

Navigation