rapidmesh
Conforming tetrahedral and surface meshes for finite element and finite volume solvers. The mesher is written in Rust; this package is a thin layer over its API, so everything here is also available to Rust programs.
- Primitives, CAD files and exact CSG: boxes, cylinders, spheres, cones, tori, prisms, sweeps, helices, lofts, fillets and chamfers, sheets, STEP files and STL/OBJ imports, united and cut by an exact arrangement. Material interfaces stay exactly conforming.
- Bottom-up meshing: edges, then each face on its analytic surface, then each region on its own, with hierarchical sizing per region, geometric face and geometric edge. Thin layers take flat tets instead of being refined to their thickness.
- Solver output: topology with orientation signs, the geometric entity
of every face and edge, named sets, periodic point pairs, gmsh MSH 4.1,
VTU, OpenFOAM polyMesh with tets or polyhedral cells
(
mesh.write_foam(case, polyhedral=True)), CalculiX/Abaqus (mesh.write_inp(path, order=2)), second-order tets on the true geometry (mesh.second_order()), finite volume quality (mesh.fvm_quality()).
Install
pip install rapidmesh
Usage
import rapidmesh as rm
g = rm.Geometry(maxh=0.5)
air = g.box(10, 10, 13.6)
sub = g.box(10, 10, 1.6, maxh=0.8)
g.label(air, "air")
g.label(sub, "substrate")
g.xy_plate(6, 6, position=(2, 2, 1.6), tag=1) # a PEC patch
g.label(1, "patch")
# a periodic unit cell, and a named port face
g.periodic(g.surf(normal=(-1, 0, 0)), g.surf(normal=(1, 0, 0)))
g.periodic(g.surf(normal=(0, -1, 0)), g.surf(normal=(0, 1, 0)))
g.surf(near=(5, 5, 13.6)).name = "port"
mesh = g.mesh()
print(mesh) # Mesh(... tets, ... points, min dihedral ... deg, ... ms)
mesh.points # (n_points, 3) float64
mesh.tets # (n_tets, 4) uint64
mesh.tet_regions # region tag per tet
mesh.topology # edges, faces, incidence with signs, classification
mesh.sets() # {"cells": ..., "faces": ..., "edges": ...} by name
mesh.periodic_points # (n, 2) point on a master face and its image
mesh.write_msh("cell.msh") # physical groups from the labels and names
mesh.without_regions([2]) # region 2 left out, its walls kept as boundary
CAD files
g = rm.Geometry(maxh=2.0)
bodies = g.import_step("assembly.step") # one solid per body of the file
mesh = g.mesh() # faces meshed on their true surfaces
STEP files (AP203 and AP214) bring planes, cylinders, cones, spheres, tori
and B-spline surfaces; coordinates stay in the file's unit. Each solid takes
the name the file gives its part, so an assembly's mesh has its parts as
named sets and physical groups. rm.read_step(path) reads a file once and
gives its unit (metres_per_unit) and body names; g.add_body(step, i)
then adds the bodies one by one, in any order, some left out.
Sizing
g.maxh = 0.5 # global target size
g.region(2).maxh = 0.2 # one region
g.surf(normal=(0, 0, 1)).maxh = 0.1 # the faces facing +z
g.edge(near=(0, 0, 1)).maxh = 0.05 # the edge nearest a point
g.tol = 1e-3 # chord tolerance of curved entities
g.refine_near_points([(1, 1, 1)], 0.02) # point size sources
mesh = g.mesh(target_elements=50_000) # an element budget
mesh = g.mesh(min_angle=15) # refined where tets stay below 15 degrees
maxh is the size the mesh needs for what lives on it; curved geometry
takes either a chord tolerance (g.tol, about ten segments round a circle
by default) or a geometric error:
mesh = g.mesh(geom_error=1e-2, order=2) # volumes and sheet areas within 1 %
# on quadratic elements
geom_error bounds the error of the volume of every region and the area of
every sheet, measured on flat elements (order=1) or on the quadratic
elements of the second-order mesh (order=2). Quadratic elements follow a
curve with far fewer of them: on CAD parts read from STEP, one percent at
order=2 takes about as many tets as the default tolerance or fewer, with a
measured error of a few hundredths of a percent.
Second order
so = mesh.second_order() # tet10: points, tets (n, 10), faces (m, 6), volumes
so["curved_tets"] # per tet: a mid-edge node off its chord
mesh.write_msh("part.msh", order=2)
mesh.write_inp("part.inp", order=2)
mesh.show(order=2) # curved faces drawn curved
Every edge takes a node in its middle, on the true geometry where the edge
lies on a curved surface or a curve. Tets with no such node keep their
mid-edge nodes in the middle of their edges (an affine map, curved_tets
false).
Surface meshes
g.surface_mesh() meshes only the surfaces (interfaces, outer boundary,
sheets) and gives its edge topology and the same sets and file output.
rm.polygon_union merges overlapping layout polygons into outlines for
sheets and prisms. Sheets in one plane take exact booleans,
g.sheet_boolean("difference", ground, slot, disc) (or "union",
"intersection"): points stay as given, and a round rim that is left stays
a circle, so a plate with a round hole extrudes into a block with an exact
bore. g.polygon_plate(points, position, axes=(u, v)) puts a polygon in
any plane.
What happened, how long, and where the quality is worst
print(mesh.report()) # stage timings, quality with location, warnings
mesh.timings # seconds per stage
mesh.metrics # predicate counts, point and tet counts
mesh.quality # min_dihedral_deg, worst_location, worst_region, regions
mesh.diagnostics # histogram, watertightness, fidelity, located defects
mesh.log # [{level, stage, message, at}, ...]
Set RAPIDMESH_LOG=1 to stream the log to stderr while meshing.
A geometry the mesher cannot mesh raises rm.MeshError (a ValueError)
whose message says where and what to repair: features far below the mesh
size, gaps between solids, degenerate faces.
License
Dual licensed: GNU Affero General Public License v3.0, or a commercial license for use in proprietary products and services without the AGPL obligations (contact milanrother.com/consulting). Versions up to 0.6.0 were published under the MIT license.
Metadata
Release files for rapidmesh 4.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| rapidmesh-4.0.1.tar.gz | 1.7 MB | With provenance | Details for rapidmesh-4.0.1.tar.gz |
Built distributions (wheels)
| File | Actions Reset | |||
|---|---|---|---|---|
| rapidmesh-4.0.1-cp310-abi3-win_amd64.whl | CPython 3.10 | abi3 | Windows x86-64 | Details for rapidmesh-4.0.1-cp310-abi3-win_amd64.whl |
| rapidmesh-4.0.1-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl | CPython 3.10 | abi3 | Linux glibc 2.17+ x86-64 | Details for rapidmesh-4.0.1-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
| rapidmesh-4.0.1-cp310-abi3-macosx_11_0_arm64.whl | CPython 3.10 | abi3 | macOS 11.0+ ARM64 | Details for rapidmesh-4.0.1-cp310-abi3-macosx_11_0_arm64.whl |
| rapidmesh-4.0.1-cp310-abi3-macosx_10_12_x86_64.whl | CPython 3.10 | abi3 | macOS 10.12+ x86-64 | Details for rapidmesh-4.0.1-cp310-abi3-macosx_10_12_x86_64.whl |
Total release size: 14.7 MB
Release files / rapidmesh-4.0.1.tar.gz
| Download URL | rapidmesh-4.0.1.tar.gz |
|---|---|
| Size | 1.7 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9520c00d874b359990bf5f6055fa9f0ba47a48b8eea234e451f01b848e5e636b
|
|
BLAKE2b-256 checksum How to use checksums |
908a8aba4a4aa733ac4ff51e8fded3298a4cc8d34669eca34c510ed9cbfeae65
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 14, 2026.
Transparency logRelease files / rapidmesh-4.0.1-cp310-abi3-win_amd64.whl
| Download URL | rapidmesh-4.0.1-cp310-abi3-win_amd64.whl |
|---|---|
| Size | 3.2 MB |
| Tags | CPython 3.10 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
2c8b241c45c53b4c8945d31529e176ee52781d08e953fc4c7016064388673b76
|
|
BLAKE2b-256 checksum How to use checksums |
e36e07316b3108bccfa9c5b32f1d67b19e001350afb35717e3bbf075fa3f9421
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 14, 2026.
Transparency logRelease files / rapidmesh-4.0.1-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | rapidmesh-4.0.1-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 3.4 MB |
| Tags | CPython 3.10 Linux glibc 2.17+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
2682c48c3851fd6062f37fff74de5a9cbc2bb7eba2a639d11ee2a2d1337df174
|
|
BLAKE2b-256 checksum How to use checksums |
53eb39ee6b1d49807d69758b9d1a561115aa05911f7af13eee3dfc8f12146f16
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 14, 2026.
Transparency logRelease files / rapidmesh-4.0.1-cp310-abi3-macosx_11_0_arm64.whl
| Download URL | rapidmesh-4.0.1-cp310-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 3.1 MB |
| Tags | CPython 3.10 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
03487d6360e7b5a3d4eab4d431848e9200728b623ff1cb86def6ac783896459d
|
|
BLAKE2b-256 checksum How to use checksums |
cf32480034a0a4abf75fc09dede1187e213f44673fb9f718a352da8c87762842
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 14, 2026.
Transparency logRelease files / rapidmesh-4.0.1-cp310-abi3-macosx_10_12_x86_64.whl
| Download URL | rapidmesh-4.0.1-cp310-abi3-macosx_10_12_x86_64.whl |
|---|---|
| Size | 3.3 MB |
| Tags | CPython 3.10 abi3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
b2bae134d66ca54527695431e4f67b5281f04e54722cb9fb3e50686c2596c54b
|
|
BLAKE2b-256 checksum How to use checksums |
57ef3916d6226962f8bd2a1a38522aba7a08074b1ea3953708702fada906cd5f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 14, 2026.
Transparency logSecurity for rapidmesh 4.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 5 files in this release have been uploaded with provenance metadata.
Attestation for rapidmesh-4.0.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 14, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.