2.1.1. Introduction to Meshing and Partitioning

2.1.1.1. Meshing

Python mesh construction starts with MeshGenerator. Calling Execute() completes the generator pipeline and returns the MeshContinuum used by a problem.

The pyopensn.mesh module provides these mesh generators:

FromFileMeshGenerator accepts meshes in the following formats:

  • msh (Gmsh)

  • vtu and pvtu (VTK unstructured grids)

  • e (Exodus II)

  • case (Ensight Gold)

  • obj (Wavefront surface meshes, for two-dimensional meshing)

Imported meshes can carry block IDs for materials and volumetric sources and boundary IDs for boundary conditions and sources. IDs can also be assigned after generation using the methods on MeshContinuum.

Mesh generators can be chained through their inputs parameter, allowing one generator to transform the output of another.

2.1.1.2. Partitioning

For parallel simulations, each mesh generator accepts a GraphPartitioner. OpenSn provides:

  • PETScGraphPartitioner, using either ParMETIS or PT-Scotch through PETSc. This is the default, with ParMETIS selected unless configured otherwise.

  • KBAGraphPartitioner, which places cuts along coordinate axes and is especially useful for orthogonal grids.

  • LinearGraphPartitioner, a simple index-based partitioner intended primarily for tests.

See the Python API reference for all generator and partitioner parameters.