When generating meshes for FEM/FVM computations, sometimes your geometry is so simple that you don't need a complex mesh generator (like pygmsh, MeshPy, mshr, pygalmesh), dmsh), but something simple and fast that makes use of the symmetries of the domain. Enter meshzoo.
import meshzoo
points, cells = meshzoo.triangle(8)
# Process the mesh, e.g., write it to a file using meshio
# meshio.write('rectangle.e', points, {'triangle': cells})
points, cells = meshzoo.rectangle(
xmin=0.0, xmax=1.0,
ymin=0.0, ymax=1.0,
nx=11, ny=11,
zigzag=True
)
points, cells = meshzoo.hexagon(3)
points, cells = meshzoo.moebius(num_twists=1, nl=60, nw=11)
points, cells = meshzoo.uv_sphere(num_points_per_circle=20, num_circles=10, radius=1.0)
points, cells = meshzoo.iso_sphere(3)
points, cells = meshzoo.tube(length=1.0, radius=1.0, n=30)
points, cells = meshzoo.cube(
xmin=0.0, xmax=1.0,
ymin=0.0, ymax=1.0,
zmin=0.0, zmax=1.0,
nx=11, ny=11, nz=11
)
In addition to this, the
examples/
directory contains a couple of instructive examples for other mesh generators.
meshzoo is available from the Python Package Index, so simply
pip install meshzoo -U
to install/upgrade.
To run the meshzoo unit tests, check out this repository and run
pytest
To create a new release
-
bump the
__version__
number, -
create Git tag and upload to PyPi:
make publish
meshzoo is published under the MIT license.