Skip to content

meiliniumowang/meshzoo

 
 

Repository files navigation

meshzoo

CircleCI codecov Code style: black PyPi Version GitHub stars

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.

Examples

Triangle

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})

Rectangle

points, cells = meshzoo.rectangle(
        xmin=0.0, xmax=1.0,
        ymin=0.0, ymax=1.0,
        nx=11, ny=11,
        zigzag=True
        )

Hexagon

points, cells = meshzoo.hexagon(3)

Möbius strip

points, cells = meshzoo.moebius(num_twists=1, nl=60, nw=11)

Sphere (surface)

points, cells = meshzoo.uv_sphere(num_points_per_circle=20, num_circles=10, radius=1.0)

points, cells = meshzoo.iso_sphere(3)

Tube

points, cells = meshzoo.tube(length=1.0, radius=1.0, n=30)

Cube

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
        )

Extra, extra

In addition to this, the examples/ directory contains a couple of instructive examples for other mesh generators.

Installation

meshzoo is available from the Python Package Index, so simply

pip install meshzoo -U

to install/upgrade.

Testing

To run the meshzoo unit tests, check out this repository and run

pytest

Distribution

To create a new release

  1. bump the __version__ number,

  2. create Git tag and upload to PyPi:

    make publish
    

License

meshzoo is published under the MIT license.

About

Some examples for mesh generation in Python

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 98.1%
  • Makefile 1.9%