Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

pymesh2D logo

pymesh2D: Delaunay-based mesh generation in Python

pymesh2D is a Python-based unstructured mesh-generator for two-dimensional polygonal geometries, providing a range of relatively simple, yet effective two-dimensional meshing algorithms. pymesh2D includes variations on the "classical" Delaunay refinement technique, a new "Frontal"-Delaunay refinement scheme, a non-linear mesh optimisation method, and auxiliary mesh and geometry pre- and post-processing facilities.

This code is a translation of MESH2D, a MATLAB / OCTAVE-based tool developed by Darren Engwirda.

Algorithms implemented in pymesh2D are "probably-good" - ensuring convergence, geometrical and topological correctness, and providing guarantees on algorithm termination and worst-case element quality bounds. Support for user-defined "mesh-spacing" functions and "multi-part" geometry definitions is also provided, allowing pymesh2D to handle a wide range of complex domain types and user-defined constraints. pymesh2D typically generates very high-quality output, appropriate for a variety of finite-volume/element type applications.

pymesh2D is a simplified version of my JIGSAW mesh-generation algorithm (a C++ code). pymesh2D aims to provide a straightforward Python implementation of these Delaunay-based triangulation and mesh optimisation techniques.

Code Structure

pymesh2D is a pure Python package, consisting of a core library + associated utilities:

pymesh2D::
├── pymesh2d              -- core pymesh2D library functions. See refine, smooth, tridemo etc.
├── pymesh2d/aabb_tree    -- support for fast spatial indexing, via tree-based data-structures.
├── pymesh2d/geom_util    -- geometry processing, repair, etc.
├── pymesh2d/geomesh_util -- mesh gestion, export interpolation, etc.
├── pymesh2d/hfun_util    -- mesh-spacing definitions, limiters, etc.
├── pymesh2d/hjac_util    -- solver for Hamilton-Jacobi eqn's.
├── pymesh2d/mesh_ball    -- circumscribing balls, orthogonal balls etc.
├── pymesh2d/mesh_cost    -- mesh cost/quality functions, etc.
├── pymesh2d/mesh_file    -- mesh i/o via ASCII serialisation.
├── pymesh2d/mesh_util    -- meshing/triangulation utility functions.
├── pymesh2d/poly_data    -- polygon definitions for demo problems, etc.
└── pymesh2d/poly_test    -- fast inclusion test for polygons.

Quickstart

Installation

You can install pymesh2d directly from PyPI:

pip install pymesh2d

If you want to install it in developer mode (for local development and contribution):

pip install -e .

Examples

python -m pymesh2d.tridemo  0; % a very simple example to get everything started.
python -m pymesh2d.tridemo  1; % investigate the impact of the "radius-edge" threshold.
python -m pymesh2d.tridemo  2; % Frontal-Delaunay vs. Delaunay-refinement refinement.
python -m pymesh2d.tridemo  3; % explore impact of user-defined mesh-size constraints.
python -m pymesh2d.tridemo  4; % explore impact of "hill-climbing" mesh optimisations.
python -m pymesh2d.tridemo  5; % assemble triangulations for "multi-part" geometries.
python -m pymesh2d.tridemo  6; % assemble triangulations with "internal" constraints.
python -m pymesh2d.tridemo  7; % investigate the use of "quadtree"-type refinement.
python -m pymesh2d.tridemo  8; % explore use of custom, user-defined mesh-size functions.
python -m pymesh2d.tridemo  9; % larger-scale problem, mesh refinement + optimisation. 
python -m pymesh2d.tridemo 10; % medium-scale problem, mesh refinement + optimisation. 

More examples available in BlueMath.

References

If you make use of pymesh2D please include a reference to the following! pymesh2D is a translation of MESH2D, designed to provide a simple and easy-to-understand implementation of Delaunay-based mesh-generation techniques. For a much more advanced and fully three-dimensional mesh-generation library, see the JIGSAW package. MESH2D makes use of the AABBTREE and FINDTRIA packages to compute efficient spatial queries and intersection tests.

[1] - Darren Engwirda, Locally-optimal Delaunay-refinement and optimisation-based mesh generation, Ph.D. Thesis, School of Mathematics and Statistics, The University of Sydney, September 2014.

[2] - Darren Engwirda, Unstructured mesh methods for the Navier-Stokes equations, Honours Thesis, School of Aerospace, Mechanical and Mechatronic Engineering, The University of Sydney, November 2005.

Metadata

Release files for pymesh2d 0.1.8.dev0

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

Source distribution (sdist)

Source distribution for pymesh2d 0.1.8.dev0
File Size Uploaded Provenance Actions
pymesh2d-0.1.8.dev0.tar.gz 282.8 kB Without provenance Details for pymesh2d-0.1.8.dev0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pymesh2d 0.1.8.dev0
File Interpreter ABI Platform Actions
pymesh2d-0.1.8.dev0-py3-none-any.whl Python 3 none any Details for pymesh2d-0.1.8.dev0-py3-none-any.whl

Total release size: 580.6 kB

Release files / pymesh2d-0.1.8.dev0.tar.gz

Download URL pymesh2d-0.1.8.dev0.tar.gz
Size 282.8 kB
Tags Source
SHA-256 checksum
How to use checksums
e8d1a1a7fb69814e18902b8f2901fa4cb10cc0e211275a10dfcb4b4cb29d8c09
BLAKE2b-256 checksum
How to use checksums
0e9e5a71772c18ccb64825203dc14f240bb09c9b5bb425e9e19d43bcc8d569b0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.14

Release files / pymesh2d-0.1.8.dev0-py3-none-any.whl

Download URL pymesh2d-0.1.8.dev0-py3-none-any.whl
Size 297.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
61683cd020da06507b4d6fff084b5a97928937bf9f8c2a025fad9174310bb22f
BLAKE2b-256 checksum
How to use checksums
903a88422a9fd028f7efb5541375b25c1f2757a7b77e9b2ab03be77d8d935beb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.14

Security for pymesh2d 0.1.8.dev0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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