mf6Voronoi
/mf6Voronoi: Easy Voronoi Mesh Generation for MODFLOW 6 (DISV)
Developed by: Saul Montoya
mf6Voronoi is an open-source Python library designed to streamline grid discretization and dynamic Voronoi mesh creation for MODFLOW 6 groundwater models utilizing the DISV (Discretization by Vertices) package.
Overview & Key Features
Groundwater modeling with complex boundary conditions and detailed hydrogeological setups often requires targeted mesh refinement. mf6Voronoi allows hydrogeologists and numerical modelers to generate robust unstructured Voronoi grids directly from geospatial vector files with minimal code.
ESRI Shapefile Native Support: Uses geospatial vector shapefiles directly to define model boundaries, local refinement areas, and line features (such as rivers or trenches).
Selective & Progressive Refinement: Seamlessly controls grid transition from coarse regional scales down to fine local discretizations using multiplier factors.
Resource Preservation: Optimizes cell counts to balance computational efficiency with high numerical accuracy around areas of interest.
Simple API & Templates: Includes pre-configured Jupyter Notebook templates for rapid grid building and MODFLOW 6 DISV package generation.
GIS Output Compatibility: Exports final Voronoi mesh polygon grids directly back to ESRI Shapefile format for inspection in GIS tools.
Installation
Install the latest version of mf6Voronoi directly from PyPI via pip:
pip install -U mf6Voronoi
Quickstart Example
Generating a Voronoi mesh with progressive refinement requires only a few lines of Python:
from mf6Voronoi.geoVoronoi import createVoronoi
# Initialize the Voronoi mesh object with coarse size and refinement multiplier
vorMesh = createVoronoi(
meshName='regionalModel',
maxRef=200, # Coarse outer grid cell size
multiplier=1.5 # Growth multiplier for progressive refinement
)
# Define outer model boundary layer
vorMesh.addLimit('basin', 'path/to/basin_boundary.shp')
# Add selective refinement areas (e.g., rivers, wells, or excavation zones)
vorMesh.addRefinementLayer('river', 'path/to/river_line.shp', refSize=20)
# Generate and export the Voronoi mesh shapefile
vorMesh.generateMesh()
Documentation & Code Repository
GitHub Repository: hatarilabs/mf6Voronoi on GitHub
Access source code, report issues, and follow repository updates.
PyPI Package: mf6Voronoi on PyPI
Comprehensive Tutorials Collection
To explore practical applications ranging from regional groundwater flow modeling to specialized industrial and mining setups, check out our full tutorial series:
