
A Python Package for Level Set Simulations¶

Overview¶
pyLSET is an open-source Python package for simulating evolving interface networks in two and three dimensions, with grain boundary evolution in polycrystals as primary applications. Each grain or region is represented by a signed distance function on a fixed Cartesian grid. Built on PyTorch, pyLSET runs on CPUs and GPUs and combines curvature-driven motion with local and anisotropic interface properties, stored-energy driving forces, prescribed advection, immobile geometries and scalar-field coupling. Its examples support method development, teaching and scientific studies of microstructure evolution. Areas of application include:
Areas of application¶
-
Materials science: Grain growth and microstructure evolution in two- and three-dimensional polycrystals, including simulations initialized from experimental grain maps.
-
Recrystallization and annealing: Grain boundary migration driven by stored-energy differences, with mobility varying across steady or transient temperature fields.
-
Microstructures with inclusions and free surfaces: Grain growth around immobile particles, holes and specimen boundaries, including non-rectangular geometries.
-
Field-driven interface evolution: Boundary motion under prescribed velocity fields or coupled scalar fields such as temperature.
pyLSET is the level set sibling of the Python-based phase field crystal code pyPFC.
Key Features¶
-
Two- and three-dimensional simulations: Use fixed Cartesian grids with periodic or mirror boundary conditions.
-
CPU and GPU execution: Choose the device and floating-point precision through PyTorch.
-
Flexible geometry setup: Initialize from pixel or voxel label maps, or read surfaces from STL, VTK, Gmsh and CAD files.
-
Versatile interface physics: Set local or anisotropic interface energies and mobilities, and include curvature flow, stored-energy driving forces or prescribed advection.
-
Junction-aware correction: Correct gaps and overlaps between domains, with energy-weighted junction corrections for interfaces with unequal energies.
-
Immobile regions and field coupling: Represent holes, particles, inclusions or specimen surfaces, and solve scalar fields on the simulation grid with interface properties that can depend on field values.
-
Memory-aware simulation and data output: Use dynamic graph coloring to reduce memory use, and save results or checkpoints in VTK and HDF5 formats.
Getting Started¶
References¶
Further details on level set modeling and example applications can be found in:
- E. Jacobsson, H. Hallberg, J. Hektor and M. Ristinmaa, Modelling diffusive phase transformations in multiphase systems using the Voronoi implicit interface method, Modelling and Simulation in Materials Science and Engineering, 33(2):025006, 2025
- E. Jacobsson, H. Hallberg, J. Hektor, S. Iyengar and M. Ristinmaa, A level set approach to modeling diffusional phase transformations under finite strains with application to the formation of Cu6Sn5, Computational Materials Science, 244:113284, 2024
- H. Hallberg and Vasily V. Bulatov, Modeling of grain growth under fully anisotropic grain boundary energy, Modelling and Simulation in Materials Science and Engineering, 27(4):045002, 2019
- H. Hallberg, F. Adamski, S. Baïz and O. Castelnau, Microstructure and property modifications of cold rolled IF steel by local laser annealing, Metallurgical and Materials Transactions A, 48(10):4786-4802, 2017.
- H. Hallberg and P.A.T. Olsson, Investigation of microstructure evolution during self-annealing in thin Cu films by combining mesoscale level set and ab-initio modeling, Journal of the Mechanics and Physics of Solids, 90:160-178, 2016
- H. Hallberg and Y. Zhu, Stability of grain boundary texture during isothermal grain growth in UO2 considering anisotropic grain boundary properties, Journal of Nuclear Materials, 465:664-673, 2015
- H. Hallberg, Influence of anisotropic grain boundary properties on the evolution of grain boundary character distribution during grain growth - A 2D level set study, Modelling and Simulation in Materials Science and Engineering, 22(8):085005, 2014
- H. Hallberg, A modified level set approach to 2D modeling of dynamic recrystallization, Modelling and Simulation in Materials Science and Engineering, 21(8):085012, 2013