Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

Tests

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
  • Imprinting and merging of conformal geometry
  • Mesh refinement
  • Programatic manipulation of .h5m tags
  • Automated testing and integration

Contents

Installation

Stellarmesh requires several dependencies that must be installed either from source or from conda-forge. At a minimum, these are moab, python-gmsh, and OCP. However, most users will likely also want build123d for geometry construction and openmc for simulation. See environment.yml for a sample conda environment.

From there, Stellarmesh can be installed from PyPI.

pip install stellarmesh

Usage

For documentation and usage examples, see the examples and tutorials folders.

Geometry construction

Stellarmesh supports both build123d (recommended) and CadQuery for geometry construction but does not depend on either.

The included examples use build123d, which can be installed from conda-forge.

Meshing

Stellarmesh supports surface meshing with both OCC and Gmsh backends.

OCC

The OpenCASCADE (OCC) meshing backend is the preferred backend when linear or angular mesh tolerances are required.

Gmsh

The Gmsh meshing backend offers a number of meshing algorithms for both surface and volume meshes. More detailed documentation, see gmsh.info.

Example

Simple torus geometry

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("doc/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.

Check overlaps
❯ overlap_check dagmc.h5m

NOTICE:
     Performing overlap check using triangle vertex locations only.
     Use the '-p' option to check more points on the triangle edges.
     Run '$ overlap_check --help' for more information.

Running overlap check:
100% |===============================================================>|+
No overlaps were found.
Check materials
❯ mbsize -ll dagmc.h5m | grep mat:

NAME = mat:a
NAME = mat:c
Check watertight
❯ check_watertight dagmc.h5m

number of surfaces=4
number of volumes=3

0/0 (nan%) unmatched edges
0/4 (0%) unsealed surfaces
0/3 (0%) unsealed volumes
leaky surface ids=
leaky volume ids=
0.173068 seconds

Other

Logging

Stellarmesh uses the logging library for debug, info and warning messages. Set the level with:

import logging

logging.basicConfig() # Required in Jupyter to correctly set output stream
logging.getLogger("stellarmesh").setLevel(logging.INFO)

Mesh refinement

Stellarmesh supports mesh refinement using the mmg library. Refine a mesh with:

refined_mesh = mesh.refine(
  ...
)

and consult the Mesh.refine and mmgs documentations for parameter values.



The refined mesh has more triangles in regions with high curvature thanks to the hausdorff parameter.

Many thanks to Erik B. Knudsen for his work on remeshing for CAD-to-OpenMC.

Acknowledgements

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

Metadata

Release files for stellarmesh 1.0.0b1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for stellarmesh 1.0.0b1
File Size Uploaded Provenance Actions
stellarmesh-1.0.0b1.tar.gz 23.4 kB With provenance Details for stellarmesh-1.0.0b1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for stellarmesh 1.0.0b1
File Interpreter ABI Platform Actions
stellarmesh-1.0.0b1-py3-none-any.whl Python 3 none any Details for stellarmesh-1.0.0b1-py3-none-any.whl

Total release size: 41.4 kB

Release files / stellarmesh-1.0.0b1.tar.gz

Download URL stellarmesh-1.0.0b1.tar.gz
Size 23.4 kB
Tags Source
SHA-256 checksum
How to use checksums
f9eae46cba116d1cb6c3728003c8fc8b602e624162d15e5d8da4b27f612eae55
BLAKE2b-256 checksum
How to use checksums
e306d70d642f714940fdfedce84554e39f98f17e7172e636af9882f5479cc88b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

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 Aug 26, 2025.

Transparency log

Release files / stellarmesh-1.0.0b1-py3-none-any.whl

Download URL stellarmesh-1.0.0b1-py3-none-any.whl
Size 18.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
342aefbfdebd51e0853987d1222c4a072f29a2f1f11d9c8ac04f27303b4c9b26
BLAKE2b-256 checksum
How to use checksums
db93743488e7929044c247e6f3949fad1120622070f28f8dcf8a4fc342f10a19
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

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 Aug 26, 2025.

Transparency log

Security for stellarmesh 1.0.0b1

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

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for stellarmesh-1.0.0b1.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 Aug 26, 2025.

Transparency log

A 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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page