Preprints
https://doi.org/10.5194/egusphere-2026-4815
https://doi.org/10.5194/egusphere-2026-4815
04 Sep 2026
 | 04 Sep 2026
Status: this preprint is open for discussion and under review for Solid Earth (SE).

PyMeshIt: An open-source geological solid modeling and tetrahedral meshing engine integrated in PZero

Waqas Hussain, Mauro Cacace, Andrea Bistacchi, and Riccardo Monti

Abstract. Volumetric mesh generation from surface-based geological models is a fundamental preprocessing step for numerical simulation of subsurface processes including fluid flow, heat transport, and deformation, with applications spanning geothermal energy, groundwater modeling and management, underground facility design, slope stability and hazard modeling, carbon sequestration and hydrocarbon reservoirs. To convert a surface-based geomodel into a volumetric mesh, build a watertight Piecewise Linear Complex (PLC) of the geological model as input to boundary-conforming meshing kernels to guarantee geometry-consistent tetrahedralization. Discretization remains challenging because geological models contain internal intersecting discontinuities, concave boundaries, folded or overturned surfaces, and geological attributes such as stratigraphic and structural identifiers and boundary condition tags that must be preserved during the meshing stage.

We present PyMeshIt, an open-source Python implementation and extension of the C++ MeshIt meshing engine (Cacace and Blöcher 2015), developed to generate watertight PLCs and tetrahedral meshes for complex geological models. PyMeshIt is developed to be used either as a standalone meshing software or as a modeling engine integrated into the open-source PZero geological modeling framework, a platform for 3D structural interpretation and modeling (Bistacchi et al. 2021). The internal architecture of PyMeshIt splits the meshing process into several sequential stages: geometric preprocessing, hull construction, primary surface generation and interpolation, intersection resolution into a consistent PLC, and a final constrained tetrahedralization.

A central technical contribution in PyMeshIt is the preservation and recovery of facet identity through the Python- TetGen interface, enabling exact extraction of fault and boundary triangle sets from the final volumetric mesh that can be input to the later numerical simulation stages (e.g., to be used to impose boundary conditions). To define boundary objects, PyMeshIt combines adaptive alpha-shape extraction for concave but projection-compatible surfaces, a 3D angular gap method for raw folded point clouds where projection-based hull algorithms fail, and a mesh-connectivity- based boundary extraction for pre-triangulated surfaces and already triangulated surfaces imported from PZero, with respect to MeshIt. We tested PyMeshIt on multiple synthetic benchmarks and five real case studies, reporting element counts and mesh quality metrics, and compared the outcomes against the original C++ implementation of MeshIt. Results demonstrate that PyMeshIt extends the original MeshIt workflow from faulted reservoir geometries to more complex folded geological models while maintaining controllable per-surface resolution, PLC consistency, and simulation-ready geological attribution. We additionally discuss the main limitations of the current implementation when dealing with very tight folds in the raw point-cloud pathway, where k-nearest-neighbour graphs used for Isomap may create cross-limb shortcuts; for such cases, pre-triangulated PZero surfaces with topology-derived boundaries currently provide a more robust alternative.

Publisher's note: Copernicus Publications remains neutral with regard to jurisdictional claims made in the text, published maps, institutional affiliations, or any other geographical representation in this paper. While Copernicus Publications makes every effort to include appropriate place names, the final responsibility lies with the authors. Views expressed in the text are those of the authors and do not necessarily reflect the views of the publisher.
Share
Waqas Hussain, Mauro Cacace, Andrea Bistacchi, and Riccardo Monti

Status: open (until 16 Oct 2026)

Comment types: AC – author | RC – referee | CC – community | EC – editor | CEC – chief editor | : Report abuse
Waqas Hussain, Mauro Cacace, Andrea Bistacchi, and Riccardo Monti

Data sets

PyMeshIt Waqas Hussain https://zenodo.org/records/21792100

Model code and software

PyMeshIt Waqas Hussain https://zenodo.org/records/21792100

Waqas Hussain, Mauro Cacace, Andrea Bistacchi, and Riccardo Monti
Metrics will be available soon.
Latest update: 04 Sep 2026
Download
Short summary
PyMeshIt provides an automated way to turn complex three-dimensional geological surfaces into consistent volume models. Its main advance is the ability to handle folded surfaces, concave boundaries, and intersecting structures that are difficult for conventional meshing approaches. Tests on synthetic and real geological examples show that it extends the earlier MeshIt method to more complex geometries while preserving important geological boundaries and labels.
Share