meshlib#

Overview#

{eval-rst}
.. sectionauthor:: Tobias Meisel (Helmholtz Centre for Environmental Research GmbH - UFZ)

meshlib is a versatile Python library designed for efficient mesh generation from surfaces. It offers a rich set of features that include supporting various meshing algorithms(e.g. prism, tetraeder, voxel in 3D), which can be customized through a range of parameters to suit specific requirements. meshlib enables the creation of meshes tailored for studies involving convergence or scalability, providing researchers and engineers with valuable insights into their simulations.

A unique aspect of meshlib is its seamless integration with both pyvista and ogs command line tools, allowing users to visualize and analyze generated meshes effortlessly. These meshes are suitable for finite element method (FEM) calculations using OpenGeoSys (OGS).

Shapefile meshing#

One feature of the meshlib is to create 2D triangular meshes within an area that is defined by a shapefile. shp2mesh_cli is the corresponding commandline tool that summarizes meshing functionalities to create a mesh from a shapefile.

Features#

  • Create a mesh from a shapefile

  • Choose between triangle and gmsh for meshing

  • Simplify the shapefile before meshing

Command line usage#

This tool allows meshing of shapefiles.

usage: shp2mesh [-h] [-i INPUT] [-o OUTPUT] [-c CELLSIZE]
                [{triangle,gmsh}] [{simplified,original}]

Positional Arguments#

meshing

Possible choices: triangle, gmsh

Either Triangle or GMSH can be chosen for meshing.

Default: “triangle”

simplify

Possible choices: simplified, original

Either the shapefiles are kept unchanged or they can be simplified.

Default: “original”

Named Arguments#

-i, --input

The path to the input shape-file.

-o, --output

The path to the output file. The extension defines the format according to meshio

-c, --cellsize

The cellsize for the mesh.

Getting started#

Following examples demonstrate the usage of the meshlib:

You can access the comprehensive API documentation at: ogstools.meshlib package.