Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. Scientific Computing
  3. pygmsh

pygmsh

GPL-3.0Pythonv7.1.17

A Python interface to Gmsh for creating complex geometries and generating meshes with useful abstractions.

GitHubGitHub
968 stars170 forks0 contributors

What is pygmsh?

pygmsh is a Python library that provides a high-level interface to Gmsh, a mesh generation tool used in computational simulations. It simplifies the process of defining complex geometries and generating meshes by abstracting Gmsh's native API into a more Pythonic workflow. The library supports 2D/3D shape creation, extrusions, CAD-style operations, and mesh refinement.

Target Audience

Researchers, engineers, and developers working in computational physics, finite element analysis, or any field requiring mesh generation for numerical simulations.

Value Proposition

pygmsh reduces the complexity of using Gmsh by offering a streamlined Python API, enabling faster prototyping of geometries and integration into Python-based scientific workflows without sacrificing Gmsh's advanced features.

Overview

:spider_web: Gmsh for Python

Use Cases

Best For

  • Generating meshes for finite element analysis (FEA) simulations
  • Creating complex 2D and 3D geometries for computational fluid dynamics (CFD)
  • Prototyping CAD-like models with boolean operations in Python
  • Automating mesh generation workflows in scientific computing pipelines
  • Applying boundary layer refinements for accurate near-wall simulations
  • Converting geometric designs into simulation-ready meshes

Not Ideal For

  • Projects requiring direct import of complex CAD formats (e.g., STEP, IGES) without manual geometry recreation
  • Environments where minimizing external dependencies is critical, such as in containerized or serverless deployments
  • Applications needing real-time, interactive mesh editing within a graphical user interface

Pros & Cons

Pros

Pythonic Abstraction

Provides a high-level, intuitive API that simplifies Gmsh's native scripting, making geometry definition more accessible for Python developers, as shown in the clean syntax for adding polygons and circles.

Advanced CAD Operations

Integrates OpenCASCADE for boolean operations like union and difference, enabling complex geometry creation directly in Python, as demonstrated in the ellipsoid with holes example.

Flexible Mesh Control

Supports boundary layers and custom mesh size callbacks, allowing for adaptive refinement crucial for accurate simulations, evidenced by the boundary layer and mesh refinement examples in the README.

Seamless Visualization Integration

Outputs meshio mesh objects, ensuring easy compatibility with tools like ParaView for post-processing, and includes a write method for Gmsh's native formats.

Cons

Gmsh Dependency

Requires separate installation and configuration of Gmsh, which adds complexity to setup and can lead to versioning issues, as noted in the installation instructions needing 'sudo apt install python3-gmsh'.

Incomplete Feature Coverage

As a wrapper, it may not expose all advanced Gmsh functionalities, potentially forcing users to revert to the native API for specialized tasks not abstracted by pygmsh.

Performance Overhead

The Python interface introduces overhead, making it less efficient for very large or complex meshes compared to using Gmsh natively in C++, which could impact iterative simulation workflows.

Frequently Asked Questions

Quick Stats

Stars968
Forks170
Contributors0
Open Issues53
Last commit2 years ago
CreatedSince 2013

Tags

#pypi#meshing#scientific-computing#mathematics#python-library#mesh-generation#finite-element-analysis#cad#engineering#numerical-simulation#python#computational-geometry

Built With

O
OpenCASCADE
P
Python
m
meshio

Included in

Scientific Computing1.5k
Auto-fetched 1 day ago

Related Projects

pygalmeshpygalmesh

:spider_web: A Python interface to CGAL's meshing tools

Stars665
Forks67
Last commit2 years ago
dmshdmsh

:spider_web: Simple mesh generator inspired by distmesh.

Stars222
Forks29
Last commit1 month ago
SeismicMeshSeismicMesh

2D/3D serial and parallel triangular mesh generation tool for finite element methods.

Stars142
Forks36
Last commit3 years ago
distmeshdistmesh

Simple generator for unstructured triangular and tetrahedral meshes. (MATLAB, GPL 3)

Stars0
Forks0
Last commit
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub