Skip to main content
QUICK REVIEW

[Paper Review] A 55-line code for large-scale parallel topology optimization in 2D and 3D

Abhinav Gupta, Rajib Chowdhury|arXiv (Cornell University)|Dec 15, 2020
Topology Optimization in EngineeringEngineering71 references9 citations
TL;DR

This paper presents a 55-line Python code for large-scale 2D and 3D topology optimization using the FEniCS finite element framework and PETSc for parallel linear algebra, enabling efficient SIMP-based optimization with filter vectorization via Euclidean distance matrices. The method achieves high performance and scalability on complex meshes, supporting multiple load cases, boundary conditions, and passive elements, making it ideal for education and large-scale research applications.

ABSTRACT

This paper presents a 55-line code written in python for 2D and 3D topology optimization (TO) based on the open-source finite element computing software (FEniCS), equipped with various finite element tools and solvers. PETSc is used as the linear algebra back-end, which results in significantly less computational time than standard python libraries. The code is designed based on the popular solid isotropic material with penalization (SIMP) methodology. Extensions to multiple load cases, different boundary conditions, and incorporation of passive elements are also presented. Thus, this implementation is the most compact implementation of SIMP based topology optimization for 3D as well as 2D problems. Utilizing the concept of Euclidean distance matrix to vectorize the computation of the weight matrix for the filter, we have achieved a substantial reduction in the computational time and have also made it possible for the code to work with complex ground structure configurations. We have also presented the code's extension to large-scale topology optimization problems with support for parallel computations on complex structural configuration, which could help students and researchers explore novel insights into the TO problem with dense meshes. Appendix-A contains the complete code, and the website: \url{https://github.com/iitrabhi/topo-fenics} also contains the complete code.

Motivation & Objective

  • To develop a compact, readable, and extensible topology optimization code that remains accessible to students and researchers while supporting large-scale problems.
  • To enable efficient large-scale 2D and 3D topology optimization using open-source tools, avoiding reliance on commercial FEA software.
  • To reduce computational time in filter computation through vectorized Euclidean distance matrices, especially for complex ground structures.
  • To support parallelization via PETSc for scalability on high-performance computing systems.
  • To extend the classic SIMP method to multiple load cases, various boundary conditions, and passive elements within a minimal codebase.

Proposed method

  • The code implements the Solid Isotropic Material with Penalization (SIMP) method using FEniCS for finite element assembly and solution.
  • It uses PETSc as the linear algebra backend to accelerate matrix operations and enable parallel computation.
  • A vectorized Euclidean distance matrix is computed to efficiently compute filter weights, replacing iterative loops and reducing computational cost.
  • The filter operation is implemented as a matrix-vector multiplication: sensitivity = (D @ (density * sensitivity)) / (density * distance_sum), where D is the distance matrix.
  • An optimality criteria method with line search is used for density update, ensuring volume constraint compliance.
  • The code supports multiple load cases, Dirichlet boundary conditions, and passive elements through modular configuration of the mesh and load markers.

Experimental results

Research questions

  • RQ1Can a highly compact 55-line code achieve scalable, high-performance 2D and 3D topology optimization using open-source tools?
  • RQ2How does vectorized Euclidean distance matrix computation improve filter efficiency compared to traditional loop-based methods?
  • RQ3To what extent can a minimal codebase support complex structural configurations, multiple load cases, and parallel execution?
  • RQ4Can such a compact implementation maintain accuracy and convergence while scaling to large meshes on HPC systems?
  • RQ5How does the integration of FEniCS and PETSc enable both educational clarity and production-level performance?

Key findings

  • The 55-line code successfully implements full 2D and 3D SIMP-based topology optimization with support for multiple load cases, boundary conditions, and passive elements.
  • The use of vectorized Euclidean distance matrices reduced filter computation time significantly, enabling efficient handling of complex ground structures.
  • The code achieves substantial performance gains through PETSc’s parallel linear algebra backend, enabling scalable computation on large meshes.
  • The implementation maintains high readability and modularity, making it suitable for educational use and rapid prototyping.
  • The code is portable across Windows, Linux, and macOS due to FEniCS’s platform independence and open-source stack.
  • The method successfully converges to optimal designs with volume constraints preserved, as demonstrated by the objective function and density evolution over iterations.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.