Tutorials¶
Most Stellarmesh workflows will resemble the following. Here:
A
Geometryobject is created from a list of build123d and CadQuery solids with associated material names.A
SurfaceMeshobject is created from the geometry with either the OCC or Gmsh backends.A
DAGMCModelobject is created from the surface mesh and written to a.h5mfile for analysis in OpenMC.
import stellarmesh as sm
solids: list[Solid] # Build123d or CadQuery solids
geometry = sm.Geometry(solids, material_names = ["l1", "l2", "l3"])
mesh = sm.SurfaceMesh.from_geometry(
geometry, sm.OCCSurfaceOptions(tol_angular_deg = 0.5)
)
mesh.write("test.msh")
h5m = sm.DAGMCModel.from_mesh(mesh)
h5m.write("dagmc.vtk")
h5m.write("dagmc.h5m")
Note
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)
Tutorials¶
The included tutorials use build123d for geometry construction. See Installation.