stellarmesh.SurfaceMesh¶
- class SurfaceMesh(mesh_filename: str | bytes | PathLike | None = None)Source¶
A surface mesh.
- classmethod from_geometry(geometry: Geometry, options: GmshSurfaceOptions | OCCSurfaceOptions) SurfaceMeshSource¶
Mesh geometry.
- Parameters:
geometry – Geometry to be meshed.
options – Meshing options.
- refine(*, min_mesh_size: float | None = None, max_mesh_size: float | None = None, const_mesh_size: float | None = None, hausdorff_value: float = 0.01, gradation_value: float = 1.3, optim: bool = False) MeshSource¶
Refine mesh using mmgs.
See mmgs documentation: https://www.mmgtools.org/mmg-remesher-try-mmg/mmg-remesher-tutorials/mmg-remesher-mmg2d/mesh-adaptation-to-a-solution for more info.
Pay particular attention to the hausdorff value, which overrides most of the other options and is typically set too low. Set to a large value, on the order of the size of your bounding box, to disable completely.
- Parameters:
min_mesh_size – -hmin: Min size of output mesh elements. Defaults to None.
max_mesh_size – -hmax: Max size of output mesh elements. Defaults to None.
const_mesh_size – -hsize: Constant size map
hausdorff_value – -hausd: Hausdorff value. Defaults to 0.01, which is
effect. (suitable for a circle of radius 1. Set to a large value to disable)
gradation_value – -hgrad Gradation value. Defaults to 1.3.
optim – -optim Do not change elements sizes. Defaults to False.
- Raises:
RuntimeError – If refinement fails.
- Returns:
New refined mesh with filename <original-filename>.refined.msh.