Skip to main content

PyPI version License: Apache-2.0 DOI status Python Version PyPI Downloads CI CI

🧠 Scikit Topt

A lightweight, flexible Python library for topology optimization built on top of Scikit Libraries

Documentation

Scikit-Topt Documentation

Examples and Features

Example 1 : Single Load Condition

Optimization Process Pull-Down-0 Optimization Process Pull-Down-1

Example 2 : Multiple Load Condition

multi-load-condition multi-load-condition-distribution

Example 3 : Heat Conduction

heat-conduction heat-conduction

Progress Report

multi-load-condition-progress

Features

To contribute to the open-source community and education—which I’ve always benefited from—I decided to start this project.

The currently supported features are as follows:

  • Coding with Python
  • easy installation with pip/poetry
  • Implement FEA on unstructured mesh using scikit-fem
  • Structural Analysis / Heat Conduction Analysis
  • Topology optimization using the density method and its optimization algorithm
    • Optimality Criteria (OC) Method
    • (Log-Space) Modified OC Method
  • able to handle multiple force condition
  • High-performance computation using sparse matrices with Scipy and PyAMG
  • has a function to monitor the transition of parameters.

SetUp

You can install Scikit-Topt either via pip or Poetry.

Supported Python Versions

Scikit-Topt supports Python 3.10–3.13:

  • 3.10–3.12 — fully supported and tested
  • 3.13 — core topology optimization works normally,
    but VTK-based features (VTU export & image rendering using PyVista)
    are temporarily unavailable because VTK/PyVista do not yet provide wheels
    for Python 3.13.

You can still run the full optimization workflow on Python 3.13;
only visualization-related features are restricted.

Choose one of the following methods:

Using pip

pip install scikit-topt

With PETSc support:

pip install "scikit-topt[petsc4py]"

The legacy alias below is also available:

pip install "scikit-topt[petsc]"

Using poetry

poetry add scikit-topt

With PETSc support:

poetry add scikit-topt -E petsc4py

petsc4py requires a working PETSc installation. If PETSc is not already available on your system, install PETSc first and then install the extra above.

PETSc Runtime Setup

The petsc4py extra installs the Python bindings only. At runtime, PETSc shared libraries must also be discoverable by your Python environment.

Common environment variables are:

  • PETSC_DIR: PETSc installation root
  • PETSC_ARCH: PETSc build architecture name
  • LD_LIBRARY_PATH: shared-library search path on Linux

Typical Linux example:

export PETSC_DIR=/path/to/petsc
export PETSC_ARCH=arch-linux-c-opt
export LD_LIBRARY_PATH="$PETSC_DIR/$PETSC_ARCH/lib:$LD_LIBRARY_PATH"

If PETSc was installed by a package manager or a preconfigured HPC module, these variables may already be set for you. In that case, no extra manual setup is needed.

You can validate the runtime with:

python -c "from petsc4py import PETSc; print(PETSc.Sys.getVersion())"

If Scikit-Topt cannot load PETSc, first check that:

  • petsc4py imports successfully
  • the PETSc shared libraries are visible in your library search path
  • PETSC_DIR and PETSC_ARCH point to the same PETSc build used for petsc4py

Optional: Enable off-screen rendering

If you want to visualize the optimized density distribution with mesh as an image, you need to enable off-screen rendering using a virtual display.

On Debian/Ubuntu:

sudo apt install xvfb libgl1-mesa-glx

CentOS / RHL

sudo yum install xvfb libgl1-mesa-glx

Usage

See examples in example directory and README.md. README for Usage Examples

Algorithm for Optimization

Optimization Algorithms and Techniques are briefly summarized here.
Optimization Algorithms and Techniques

Contributing

We are happy to welcome any contributions to the library. You can contribute in various ways:

  • Reporting bugs, opening pull requests, or starting discussions via GitHub Issues
  • Writing new examples
  • Improving the tests
  • Enhancing the documentation or code readability doc

By contributing code to Scikit-Topt, you agree to release it under the Apache 2.0 License.

Acknowledgements

Standing on the shoulders of proverbial giants

This software does not exist in a vacuum. Scikit-Topt is standing on the shoulders of proverbial giants. In particular, I want to thank the following projects for constituting the technical backbone of the project:

  • Scipy
  • Scikit-fem
  • PyAMG
  • Numba
  • MeshIO
  • Matplotlib
  • PyVista
  • Topology Optimization Community

📖 Citation

If you use Scikit Topt in your research or software, please cite it as:

@article{Watanabe_Scikit-Topt_A_Python_2025,
author = {Watanabe, Kohei},
doi = {10.21105/joss.09092},
journal = {Journal of Open Source Software},
number = {116},
title = {{Scikit-Topt: A Python Library for Algorithm Development in Topology Optimization}},
volume = {10},
year = {2025}
}

ToDo

  • Set break point from the optimization loop
  • Add A feature to assign tags to nodes and cells
  • Add Level Set
  • Add other optimizers
    • Evolutionary Algorithms
    • MMA
  • Add Multiple BC Conditions
  • Add Unit Test

Metadata

Release files for scikit-topt 0.3.10

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for scikit-topt 0.3.10
File Size Uploaded
scikit_topt-0.3.10.tar.gz 115.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for scikit-topt 0.3.10
File Interpreter ABI Platform
scikit_topt-0.3.10-py3-none-any.whl Python 3 none any Details

Total release size: 280.9 kB

Release files / scikit_topt-0.3.10.tar.gz

Download URL scikit_topt-0.3.10.tar.gz
Size 115.7 kB
Tags Source
SHA-256 checksum
How to use checksums
9907f9f227e96e49bbfb93010eb4230d59f61b744751b717f2575194e3c31001
BLAKE2b-256 checksum
How to use checksums
effa30013179b95f6b0bddfaa1b97d80154a711fb57f6567743d9b8d92a4c204
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.2 CPython/3.11.6 Linux/6.8.0-111-generic

Release files / scikit_topt-0.3.10-py3-none-any.whl

Download URL scikit_topt-0.3.10-py3-none-any.whl
Size 165.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bc138e3defef377538d4d928942e9120b5acdf3d9ec6bcb8220161a16277baed
BLAKE2b-256 checksum
How to use checksums
31761c0a5e8842fb345ce6c800ef084f79e7c02e25dfc261662367dbd18249ab
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.2 CPython/3.11.6 Linux/6.8.0-111-generic

Release history Release notifications | RSS feed

This release

0.3.10 This release

2 release files

0.3.9

2 release files

0.3.8

2 release files

0.3.7

2 release files

0.3.6

2 release files

0.3.5

2 release files

0.3.4

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.2.18

2 release files

0.2.13

2 release files

0.2.12

2 release files

0.2.8

2 release files

0.2.7

2 release files

0.2.6

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.8

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page