Skip to main content
Log in

An efficient 146-line 3D sensitivity analysis code of stress-based topology optimization written in MATLAB

  • Educational Article
  • Published:
Optimization and Engineering Aims and scope Submit manuscript

A Correction to this article was published on 08 July 2022

This article has been updated

Abstract

This paper presents an efficient and compact MATLAB code for three-dimensional stress-based sensitivity analysis. The 146 lines code includes the finite element analysis and p-norm stress sensitivity analysis based on the adjoint method. The 3D sensitivity analysis for p-norm global stress measure is derived and explained in detail accompanied by corresponding MATLAB code. The correctness of the analytical sensitivity is verified by comparison with finite difference approximation. The nonlinear optimization solver is chosen as the Method of moving asymptotes (MMA). Three typical volume-constrained stress minimization problems are presented to verify the effectiveness of sensitivity analysis code. The MATLAB code presented in this paper can be extended to resolve different stress related 3D topology optimization problems. The complete program for sensitivity analysis is given in the Appendix and is intended for educational purposes. MATLAB code is additionally provided in electronic supplementary material for a simple cantilever beam optimization.

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

Similar content being viewed by others

Change history

References

  • Aage N, Andreassen E, Lazarov BS (2015) Topology optimization using PETSc: an easy-to-use, fully parallel, open source topology optimization framework. Struct Multidiscip Optim 51(3):565–572

    Article  MathSciNet  Google Scholar 

  • Allaire G, Jouve F (2008) Minimum stress optimal design with the level set method. Eng Anal Bound Elem 32(11):909–918

    Article  MATH  Google Scholar 

  • Allaire G, Dapogny C, Frey P (2014) Shape optimization with a level set based mesh evolution method. Comput Methods Appl Mech Eng 282:22–53

    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):1–16

    Article  MATH  Google Scholar 

  • Bendsoe MP, Sigmund O (2013) Topology optimization: theory, methods, and applications. Springer Science & Business Media.

  • Bendsoe MP, Kikuchi N (1988) Generating optimal topologies in structural design using a homogenization method. Comput Methods Appl Mech Eng 71(2):197–224

    Article  MathSciNet  MATH  Google Scholar 

  • Bendsøe MP, Sigmund O (1999) Material interpolation schemes in topology optimization. Arch Appl Mech 69(9–10):635–654

    MATH  Google Scholar 

  • Bruggi M, Duysinx P (2012) Topology optimization for minimum weight with compliance and stress constraints. Struct Multidiscip Optim 46(3):369–384

    Article  MathSciNet  MATH  Google Scholar 

  • Cai S, Zhang W (2015) Stress constrained topology optimization with free-form design domains. Comput Methods Appl Mech Eng 289:267–290

    Article  MathSciNet  MATH  Google Scholar 

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

    Article  MathSciNet  MATH  Google Scholar 

  • Chen Q, Zhang X, Zhu B (2019) A 213-line topology optimization code for geometrically nonlinear structures. Struct Multidiscip Optim 59(5):1863–1879

    Article  MathSciNet  Google Scholar 

  • Cheng G, Guo X (1997) ε-relaxed approach in structural topology optimization. Struct Optim 13(4):258–266

    Article  Google Scholar 

  • Dapogny C, Frey P, Omnès F, Privat Y (2018) Geometrical shape optimization in fluid mechanics using FreeFem++. Struct Multidiscip Optim 58(6):2761–2788

    Article  MathSciNet  Google Scholar 

  • Deng H, To AC (2020) Topology optimization based on deep representation learning (DRL) for compliance and stress-constrained design. Comput Mech 66:449–469

    Article  MathSciNet  MATH  Google Scholar 

  • Deng H, Cheng L, To AC (2019) Distortion energy-based topology optimization design of hyperelastic materials. Struct Multidiscip Optim 59(6):1895–1913

    Article  MathSciNet  Google Scholar 

  • Deng H, Hinnebusch S, To AC (2020a) Topology optimization design of stretchable metamaterials with Bézier skeleton explicit density (BSED) representation algorithm. Comput Methods Appl Mech Eng 366:113093

    Article  MATH  Google Scholar 

  • Deng H, Cheng L, Liang X, Hayduke D, To AC (2020b) Topology optimization for energy dissipation design of lattice structures through snap-through behavior. Comput Methods Appl Mech Eng 358:112641

    Article  MathSciNet  MATH  Google Scholar 

  • Duysinx P, Sigmund O (1998) New developments in handling stress constraints in optimal material distribution. In 7th AIAA/USAF/NASA/ISSMO symposium on multidisciplinary analysis and optimization, p 4906.

  • Duysinx P, Bendsøe MP (1998) Topology optimization of continuum structures with local stress constraints. Int J Numer Meth Eng 43(8):1453–1478

    Article  MathSciNet  MATH  Google Scholar 

  • Emmendoerfer H Jr, Fancello EA (2016) Topology optimization with local stress constraint based on level set evolution via reaction–diffusion. Comput Methods Appl Mech Eng 305:62–88

    Article  MathSciNet  MATH  Google Scholar 

  • Fan Z, Xia L, Lai W, Xia Q, Shi T (2019) Evolutionary topology optimization of continuum structures with stress constraints. Struct Multidiscip Optim 59(2):647–658

    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. arXiv preprint arXiv:2005.05436.

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

    Article  MathSciNet  Google Scholar 

  • Guo X, Zhang WS, Wang MY, Wei P (2011) Stress-related topology optimization via level set approach. Comput Methods Appl Mech Eng 200(47–48):3439–3452

    Article  MathSciNet  MATH  Google Scholar 

  • Holmberg E, Torstenfelt B, Klarbring A (2013) Stress constrained topology optimization. Struct Multidiscip Optim 48(1):33–47

    Article  MathSciNet  MATH  Google Scholar 

  • Huang X, Xie Y-M (2010) A further review of ESO type methods for topology optimization. Struct Multidiscip Optim 41(5):671–683

    Article  Google Scholar 

  • James KA, Lee E, Martins JR (2012) Stress-based topology optimization using an isoparametric level set method. Finite Elem Anal Des 58:20–30

    Article  Google Scholar 

  • Kambampati S, Gray JS, Kim HA (2020) Level set topology optimization of structures under stress and temperature constraints. Comput Struct 235:106265

    Article  Google Scholar 

  • Kirsch U (1990) On singular topologies in optimum structural design. Struct Optim 2(3):133–142

    Article  Google Scholar 

  • Kočvara M, Stingl M (2012) Solving stress constrained problems in topology and material optimization. Struct Multidiscip Optim 46(1):1–15

    Article  MathSciNet  MATH  Google Scholar 

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

    Article  MathSciNet  Google Scholar 

  • Le C, Norato J, Bruns T, Ha C, Tortorelli D (2010) Stress-based topology optimization for continua. Struct Multidiscip Optim 41(4):605–620

    Article  Google Scholar 

  • Liang Y, Cheng G (2020) Further elaborations on topology optimization via sequential integer programming and Canonical relaxation algorithm and 128-line MATLAB code. Struct Multidiscip Optim 61(1):411–431

    Article  Google Scholar 

  • Lin H, Xu A, Misra A, Zhao R (2020) An ANSYS APDL code for topology optimization of structures with multi-constraints using the BESO method with dynamic evolution rate (DER-BESO). Struct Multidiscip Optim 62:1–26

    Article  MathSciNet  Google Scholar 

  • Liu K, Tovar A (2014) An efficient 3D topology optimization code written in Matlab. Struct Multidiscip Optim 50(6):1175–1196

    Article  MathSciNet  Google Scholar 

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

    Article  MathSciNet  MATH  Google Scholar 

  • Loyola RA, Querin OM, Jiménez AG, Gordoa CA (2018) A sequential element rejection and admission (SERA) topology optimization code written in Matlab. Struct Multidiscip Optim 58(3):1297–1310

    Article  MathSciNet  Google Scholar 

  • Luo Y, Wang MY, Kang Z (2013) An enhanced aggregation method for topology optimization with local stress constraints. Comput Methods Appl Mech Eng 254:31–41

    Article  MathSciNet  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(5):1159–1172

    Article  MathSciNet  Google Scholar 

  • París J, Navarrina F, Colominas I, Casteleiro M (2009) Topology optimization of continuum structures with local and global stress constraints. Struct Multidiscip Optim 39(4):419–437

    Article  MathSciNet  MATH  Google Scholar 

  • Paris J, Navarrina F, Colominas I, Casteleiro M (2010) Stress constraints sensitivity analysis in structural topology optimization. Comput Methods Appl Mech Eng 199(33–36):2110–2122

    Article  MathSciNet  MATH  Google Scholar 

  • Pereira A, Talischi C, Paulino GH, Menezes IF, Carvalho MS (2016) Fluid flow topology optimization in PolyTop: stability and computational implementation. Struct Multidiscip Optim 54(5):1345–1364

    Article  MathSciNet  Google Scholar 

  • Picelli R, Townsend S, Brampton C, Norato J, Kim HA (2018a) Stress-based shape and topology optimization with the level set method. Comput Methods Appl Mech Eng 329:1–23

    Article  MathSciNet  MATH  Google Scholar 

  • Picelli R, Townsend S, Kim HA (2018b) Stress and strain control via level set topology optimization. Struct Multidiscip Optim 58(5):2037–2051

    Article  MathSciNet  Google Scholar 

  • Picelli R, Sivapuram R, Xie YM (2020) A 101-line MATLAB code for topology optimization using binary variables and integer programming. Struct Multidiscip Optim 63:1–20

    MathSciNet  Google Scholar 

  • Sanders ED, Pereira A, Aguiló MA, Paulino GH (2018) PolyMat: an efficient Matlab code for multi-material topology optimization. Struct Multidiscip Optim 58(6):2727–2759

    Article  MathSciNet  Google Scholar 

  • Senhora FV, Giraldo-Londono O, Menezes IF, Paulino GH (2020) Topology optimization with local stress constraints: a stress aggregation-free approach. Struct Multidiscip Optim 62(4):1639–1668

    Article  MathSciNet  Google Scholar 

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

    Article  Google Scholar 

  • Sigmund O (2007) Morphology-based black and white filters for topology optimization. Struct Multidiscip Optim 33(4–5):401–424

    Article  Google Scholar 

  • Smith H, Norato JA (2020) A MATLAB code for topology optimization using the geometry projection method. Struct Multidiscip Optim 62:1–16

    Article  MathSciNet  Google Scholar 

  • Song Y, Ma Q, He Y, Zhou M, Wang MY (2020) Stress-based shape and topology optimization with cellular level set in B-splines. Struct Multidiscip Optim 62(5):2391–2407

    Article  MathSciNet  Google Scholar 

  • Suresh K (2010) A 199-line Matlab code for Pareto-optimal tracing in topology optimization. Struct Multidiscip Optim 42(5):665–679

    Article  MathSciNet  MATH  Google Scholar 

  • Suresh K, Takalloozadeh M (2013) Stress-constrained topology optimization: a topological level-set approach. Struct Multidiscip Optim 48(2):295–309

    Article  MathSciNet  Google Scholar 

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

    Article  MathSciNet  MATH  Google Scholar 

  • Talischi C, Paulino GH, Pereira A, Menezes IF (2012) PolyTop: a Matlab implementation of a general topology optimization framework using unstructured polygonal finite element meshes. Struct Multidiscip Optim 45(3):329–357

    Article  MathSciNet  MATH  Google Scholar 

  • Van Miegroet L, Duysinx P (2007) Stress concentration minimization of 2D filets using X-FEM and level set description. Struct Multidiscip Optim 33(4–5):425–438

    Article  Google Scholar 

  • Wang MY, Li L (2013) Shape equilibrium constraint: a strategy for stress-constrained structural topology optimization. Struct Multidiscip Optim 47(3):335–352

    Article  MathSciNet  MATH  Google Scholar 

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

    Article  MathSciNet  MATH  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(2):831–849

    Article  MathSciNet  Google Scholar 

  • Xia L, Breitkopf P (2015) Design of materials using topology optimization and energy-based homogenization approach in Matlab. Struct Multidiscip Optim 52(6):1229–1241

    Article  MathSciNet  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:55–64

    Article  Google Scholar 

  • Xia Q, Wang MY, Shi T (2014) A level set method for shape and topology optimization of both structure and support of continuum structures. Comput Methods Appl Mech Eng 272:340–353

    Article  MathSciNet  MATH  Google Scholar 

  • Xia L, Zhang L, Xia Q, Shi T (2018) Stress-based topology optimization using bi-directional evolutionary structural optimization method. Comput Methods Appl Mech Eng 333:356–370

    Article  MathSciNet  MATH  Google Scholar 

  • Yang D, Liu H, Zhang W, Li S (2018) Stress-constrained topology optimization based on maximum stress measures. Comput Struct 198:23–39

    Article  Google Scholar 

  • Zegard T, Paulino GH (2014) GRAND—Ground structure based topology optimization for arbitrary 2D domains using MATLAB. Struct Multidiscip Optim 50(5):861–882

    Article  MathSciNet  Google Scholar 

  • Zhang WS, Guo X, Wang MY, Wei P (2013) Optimal topology design of continuum structures with stress concentration alleviation via level set method. Int J Numer Meth Eng 93(9):942–959

    Article  MathSciNet  MATH  Google Scholar 

  • Zhang S, Norato JA, Gain AL, Lyu N (2016) A geometry projection method for the topology optimization of plate structures. Struct Multidiscip Optim 54(5):1173–1190

    Article  MathSciNet  Google Scholar 

  • Zhang S, Gain AL, Norato JA (2017) Stress-based topology optimization with discrete geometric components. Comput Methods Appl Mech Eng 325:1–21

    Article  MathSciNet  MATH  Google Scholar 

  • Zhang W, Li D, Zhou J, Du Z, Li B, Guo X (2018) A moving morphable void (MMV)-based explicit approach for topology optimization considering stress constraints. Comput Methods Appl Mech Eng 334:381–413

    Article  MathSciNet  MATH  Google Scholar 

  • Zhu B et al (2020) Design of compliant mechanisms using continuum topology optimization: a review. Mech Mach Theory 143:103622

    Article  Google Scholar 

Download references

Acknowledgements

The financial support for this work from National Science Foundation (CMMI-1634261) is gratefully acknowledged. The authors would like to thank Krister Svanberg for providing the MATLAB implementation of his Method of Moving Asymptotes, which was used in this work.

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Albert C. To.

Additional information

Publisher's Note

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

The original online version of this article was revised:

Appendices

Appendix A: MATLAB Program Stress_3D_Sensitivity

The MATLAB code used in this work can be downloaded from: https://github.com/PittAMRL/StressTopOpt.

Appendix B: MATLAB Program Plot_von_Mises

figure q

Rights and permissions

Reprints and permissions

About this article

Check for updates. Verify currency and authenticity via CrossMark

Cite this article

Deng, H., Vulimiri, P.S. & To, A.C. An efficient 146-line 3D sensitivity analysis code of stress-based topology optimization written in MATLAB. Optim Eng 23, 1733–1757 (2022). https://doi.org/10.1007/s11081-021-09675-3

Download citation

  • Received:

  • Revised:

  • Accepted:

  • Published:

  • Issue Date:

  • DOI: https://doi.org/10.1007/s11081-021-09675-3

Keywords

Navigation