PyMeshGen 
PyMeshGen is an open-source Python project for unstructured mesh generation aimed at CFD/FEA preprocessing and algorithm research. The actively maintained runtime focuses on 2D workflows built around Fluent .cas boundary input, quadtree sizing, boundary-layer growth, advancing-front meshing, and a Delaunay pipeline with Bowyer-Watson and Triangle backends.
Highlights
- Fluent
.cas-driven boundary import for meshing workflows - VTK and STL import/export support
- PyQt5 GUI and command-line entry points
- Boundary-layer generation plus interior triangular and hybrid tri/quad meshing
- Quadtree-based sizing field and post-meshing optimization
- Experimental neural-network and reinforcement-learning smoothing modules under
neural/
Requirements
- Python 3.8+
- Core runtime dependencies:
pip install -r requirements.txt
Optional heavyweight dependencies are split out:
pip install -r requirements-optional.txt
Some optional workflows, especially geometry import/export and neural/ML smoothing, rely on packages such as pythonocc-core, torch, torch-geometric, stable-baselines3, and trimesh.
Installation
PyPI (preferred after publication)
pip install pymeshgen
Optional extras:
pip install "pymeshgen[ml]"
pip install "pymeshgen[occ]"
pythonocc-core may be easier to install via conda-forge on some platforms.
Available entry points after installation:
pymeshgen --case ".\config\30p30n.json"
pymeshgen-gui
Local development
pip install -e .
For full local feature coverage:
pip install -r requirements.txt
pip install -r requirements-optional.txt
Quick start
Command line
python PyMeshGen.py --case ".\config\30p30n.json"
If --case is omitted, Parameters falls back to config\main.json, which points to the active case JSON.
GUI
python start_gui.py
The GUI bootstraps project paths automatically and also adds 3rd_party\meshio\src to sys.path for bundled meshio compatibility.
Library usage
from data_structure.parameters import Parameters
from PyMeshGen import PyMeshGen
params = Parameters("FROM_CASE_JSON", r".\config\30p30n.json")
mesh = PyMeshGen(params)
Configuration model
Case JSON files live under config/ and typically define:
input_file/output_filemesh_typedelaunay_backendtriangle_point_strategy- global sizing / visualization options
parts, where each part must provide at leastpart_name
Common part-level options include max_size, PRISM_SWITCH, first_height, growth_rate, max_layers, full_layers, and multi_direction.
Meshing pipelines
mesh_type |
Pipeline |
|---|---|
1, 2 |
Triangular mesh generation through the advancing-front pipeline |
3 |
Hybrid tri/quad generation; triangle_to_quad_method == "q_morph" uses a triangle-first path |
4 |
Delaunay triangulation through delaunay.create_bowyer_watson_mesh() |
Notes for mesh_type == 4:
delaunay_backenddefaults tobowyer_watsontriangle_point_strategydefaults toequilateral- when boundary layers are enabled, the effective interior backend is forced to
triangleto improve robustness near layered fronts
Project structure
| Path | Responsibility |
|---|---|
PyMeshGen.py |
CLI entry and lightweight library wrapper |
start_gui.py |
GUI launcher |
core.py |
Main orchestration pipeline |
data_structure/ |
Parameters, fronts, cells, and Unstructured_Grid |
meshsize/ |
Quadtree sizing-field construction |
adfront2/ |
Boundary-layer and advancing-front interior generation |
delaunay/ |
Bowyer-Watson core, Triangle backend, validation, and postprocess helpers |
fileIO/ |
CAS/VTK/STL/OCC input-output utilities |
gui/ |
PyQt5 GUI modules |
optimize/ |
Mesh optimization and smoothing |
unittests/ |
Regression and unit tests |
Testing
Run the existing repository test entry points:
cd unittests
python run_tests.py
python run_quick_tests.py
Run a focused unittest target from the repository root when working on Delaunay or boundary-layer logic:
python -m unittest unittests.test_bowyer_watson.TestBowyerWatsonJSONConfig.test_anw_bowyer_watson
Documentation
- Chinese overview:
README_zh.md - Packaging and release workflow:
README_PACKAGING.md - Delaunay design notes:
docs/design/Delaunay模块详细设计.md - GUI design notes:
docs/design/README_GUI module.md - Model tree notes:
docs/design/README_model tree.md
Packaging
PyMeshGen now prioritizes Python package distribution through PyPI.
For standard Python source and wheel builds:
python -m pip install build
python -m build
For PyPI publishing and release workflow details, see README_PACKAGING.md. Optional Windows desktop packaging tools now live under packaging/windows/.
License
PyMeshGen is distributed under GPLv2+. See LICENSE.txt.
Contact
- Project initiator: cfd_dev cfd_dev@126.com
Metadata
Release files for PyMeshGen 1.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pymeshgen-1.1.1.tar.gz | 6.1 MB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pymeshgen-1.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 16.6 MB
Release files / pymeshgen-1.1.1.tar.gz
| Download URL | pymeshgen-1.1.1.tar.gz |
|---|---|
| Size | 6.1 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
742aedaeb5e5f12e2a072f0abbe2ea61e32551ea1ae6c9950bf2edcf96dfb35f
|
|
BLAKE2b-256 checksum How to use checksums |
0275b480639936027c91140bc31355942af707b6b903e7bc1679543b4caae91b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 27, 2026.
Transparency logRelease files / pymeshgen-1.1.1-py3-none-any.whl
| Download URL | pymeshgen-1.1.1-py3-none-any.whl |
|---|---|
| Size | 10.5 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
93c2157a29ad17c6387071c64f678c74e90f1641faad56564dc62fa8dfea0c03
|
|
BLAKE2b-256 checksum How to use checksums |
827f227009a1ccfeb11f8ed841f62313a953c11076450922ad5d72d266126c44
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 27, 2026.
Transparency log