Python-based unstructured mesh generator for CFD/FEA preprocessing and algorithm research
Project description
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pymeshgen-1.1.1.tar.gz.
File metadata
- Download URL: pymeshgen-1.1.1.tar.gz
- Upload date:
- Size: 6.1 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
742aedaeb5e5f12e2a072f0abbe2ea61e32551ea1ae6c9950bf2edcf96dfb35f
|
|
| MD5 |
664eeb7f387e56f3c06c1618b03f3e62
|
|
| BLAKE2b-256 |
0275b480639936027c91140bc31355942af707b6b903e7bc1679543b4caae91b
|
Provenance
The following attestation bundles were made for pymeshgen-1.1.1.tar.gz:
Publisher:
publish-pypi.yml on cfd-dev/PyMeshGen
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pymeshgen-1.1.1.tar.gz -
Subject digest:
742aedaeb5e5f12e2a072f0abbe2ea61e32551ea1ae6c9950bf2edcf96dfb35f - Sigstore transparency entry: 1393418649
- Sigstore integration time:
-
Permalink:
cfd-dev/PyMeshGen@eae7690a4dc17ccfe9c7606d4973ecdf2ff861c7 -
Branch / Tag:
refs/tags/v1.1.1 - Owner: https://github.com/cfd-dev
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@eae7690a4dc17ccfe9c7606d4973ecdf2ff861c7 -
Trigger Event:
release
-
Statement type:
File details
Details for the file pymeshgen-1.1.1-py3-none-any.whl.
File metadata
- Download URL: pymeshgen-1.1.1-py3-none-any.whl
- Upload date:
- Size: 10.5 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
93c2157a29ad17c6387071c64f678c74e90f1641faad56564dc62fa8dfea0c03
|
|
| MD5 |
ce1c0af8b9bc8aecadcf06a83ce4fea5
|
|
| BLAKE2b-256 |
827f227009a1ccfeb11f8ed841f62313a953c11076450922ad5d72d266126c44
|
Provenance
The following attestation bundles were made for pymeshgen-1.1.1-py3-none-any.whl:
Publisher:
publish-pypi.yml on cfd-dev/PyMeshGen
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pymeshgen-1.1.1-py3-none-any.whl -
Subject digest:
93c2157a29ad17c6387071c64f678c74e90f1641faad56564dc62fa8dfea0c03 - Sigstore transparency entry: 1393418657
- Sigstore integration time:
-
Permalink:
cfd-dev/PyMeshGen@eae7690a4dc17ccfe9c7606d4973ecdf2ff861c7 -
Branch / Tag:
refs/tags/v1.1.1 - Owner: https://github.com/cfd-dev
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@eae7690a4dc17ccfe9c7606d4973ecdf2ff861c7 -
Trigger Event:
release
-
Statement type: