Mesh

Stellarmesh supports surface meshing with both OCC and Gmsh backends.

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. For more detailed documentation, see gmsh.info.

Specifying Mesh Options

The SurfaceMesh.from_geometry() constructor takes either an OCCSurfaceOptions or GmshSurfaceOptions options class as a parameter. Use this parameter to select the meshing backend and specify meshing options.

from_geometry(geometry: Geometry, options: GmshSurfaceOptions | OCCSurfaceOptions) SurfaceMesh

Mesh geometry.

Parameters:
  • geometry – Geometry to be meshed.

  • options – Meshing options.

Mesh Refinement

Note

Given CAD geometry, Gmsh often produces high-quality meshes that do not benefit from remeshing.

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

refined_mesh = mesh.refine(
  ...
)

and consult the SurfaceMesh.refine() and mmgs documentations for parameter values.

https://github.com/Thea-Energy/stellarmesh/assets/43913902/f3440b6b-3e11-476a-9fae-ab9708f8f2b2
https://github.com/Thea-Energy/stellarmesh/assets/43913902/29acbdb3-24a2-419d-9f3f-237aec475369

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.

API

Mesh([mesh_filename])

A Gmsh mesh.

SurfaceMesh([mesh_filename])

A surface mesh.

VolumeMesh([mesh_filename])

Volume Mesh.

OCCSurfaceOptions(*[, tol_angular_deg, ...])

OCC surface meshing options.

OCCSurfaceAlgo(*values)

OCC surface meshing algorithm.

GmshSurfaceOptions(*[, min_mesh_size, ...])

Gmsh surface meshing options.

GmshSurfaceAlgo(*values)

Algorithm used by Gmsh for surface meshing.

GmshVolumeOptions(*[, min_mesh_size, ...])

Gmsh volume meshing options.

GmshVolumeAlgo(*values)

Algorithm used by Gmsh for volume meshing.