https://github.com/Thea-Energy/stellarmesh/raw/main/docs/logo.png

Tests PyPI Version Conda Version

Stellarmesh is a meshing library for nuclear workflows. Principally, it supports the creation of DAGMC geometry from CAD models.

Features:

  • ✅ Import of CadQuery, build123d, STEP and BREP geometry

  • ✅ Surface and volume meshing

  • ✅ Gmsh and OpenCASCADE meshing backends

  • ✅ Linear and angular mesh tolerances

  • ✅ Surface boundary conditions

  • ✅ Imprinting and merging of conformal geometry

  • ✅ Mesh refinement

  • ✅ Programmatic manipulation of .h5m tags

  • ✅ Automated testing and integration

Getting Started

Example

import build123d as bd
import stellarmesh as sm

solids = [bd.Solid.make_torus(1000, 100)]
for _ in range(3):
    solids.append(bd.Solid.thicken(solids[-1].faces()[0], 100))
solids = solids[1:]

geometry = sm.Geometry(solids[::-1], material_names=["a", "a", "c"])
mesh = sm.SurfaceMesh.from_geometry(
    geometry, sm.GmshSurfaceOptions(min_mesh_size=50, max_mesh_size=200)
)
mesh.write("test.msh")
mesh.render("docs/torus-mesh-reversed.png", rotation_xyz=(90, 0, -90), normals=15)

h5m = sm.DAGMCModel.from_mesh(mesh)
h5m.write("dagmc.h5m")
h5m.write("dagmc.vtk")
Rendered mesh with normals.

Acknowledgements

Stellarmesh is originally a project of Thea Energy, who are building the world’s first planar coil stellarator.

https://github.com/user-attachments/assets/37b9ba1c-b22c-4837-b226-a6212854127e