pylset 0.0.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pylset-0.0.1.dist-info/METADATA +123 -0
- pylset-0.0.1.dist-info/RECORD +11 -0
- pylset-0.0.1.dist-info/WHEEL +5 -0
- pylset-0.0.1.dist-info/licenses/LICENSE +674 -0
- pylset-0.0.1.dist-info/top_level.txt +6 -0
- pylset.py +3063 -0
- pylset_base.py +1214 -0
- pylset_grid.py +211 -0
- pylset_io.py +899 -0
- pylset_mesh.py +26 -0
- pylset_pre.py +903 -0
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pylset
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: A Python Package for Level Set Simulations of Microstructure Evolution
|
|
5
|
+
Author-email: Håkan Hallberg <hakan.hallb@protonmail.com>
|
|
6
|
+
License-Expression: GPL-3.0-or-later
|
|
7
|
+
Project-URL: Homepage, https://github.com/HHallb/pyLSET
|
|
8
|
+
Project-URL: Repository, https://github.com/HHallb/pyLSET
|
|
9
|
+
Keywords: level set,grain growth,microstructure,simulation,gpu
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Classifier: Development Status :: 2 - Pre-Alpha
|
|
16
|
+
Requires-Python: <3.14,>=3.11
|
|
17
|
+
Description-Content-Type: text/markdown
|
|
18
|
+
License-File: LICENSE
|
|
19
|
+
Requires-Dist: numpy
|
|
20
|
+
Requires-Dist: scipy
|
|
21
|
+
Requires-Dist: torch
|
|
22
|
+
Requires-Dist: h5py
|
|
23
|
+
Requires-Dist: vtk
|
|
24
|
+
Requires-Dist: scikit-image
|
|
25
|
+
Provides-Extra: fmm
|
|
26
|
+
Requires-Dist: scikit-fmm; extra == "fmm"
|
|
27
|
+
Provides-Extra: mesh
|
|
28
|
+
Requires-Dist: gmsh; extra == "mesh"
|
|
29
|
+
Provides-Extra: edt
|
|
30
|
+
Requires-Dist: edt; extra == "edt"
|
|
31
|
+
Provides-Extra: test
|
|
32
|
+
Requires-Dist: pytest; extra == "test"
|
|
33
|
+
Provides-Extra: docs
|
|
34
|
+
Requires-Dist: mkdocs; extra == "docs"
|
|
35
|
+
Requires-Dist: mkdocs-material; extra == "docs"
|
|
36
|
+
Requires-Dist: mkdocstrings[python]; extra == "docs"
|
|
37
|
+
Requires-Dist: mkdocs-jupyter; extra == "docs"
|
|
38
|
+
Dynamic: license-file
|
|
39
|
+
|
|
40
|
+

|
|
41
|
+

|
|
42
|
+
|
|
43
|
+

|
|
44
|
+
|
|
45
|
+
# pyLSET: A Python Package for Level Set Simulations
|
|
46
|
+
|
|
47
|
+

|
|
48
|
+
|
|
49
|
+
pyLSET is a Python package for level set simulations of interface networks in 2D and 3D, with grain boundaries in polycrystals as the primary application. It runs on CPUs or GPUs through PyTorch. pyLSET is the level set sibling of the Python-based phase field crystal code [pyPFC](https://github.com/HHallb/pyPFC).
|
|
50
|
+
|
|
51
|
+
## Features
|
|
52
|
+
|
|
53
|
+
- Fixed Cartesian grids in 2D and 3D, with the dimensionality set by the input data.
|
|
54
|
+
- Periodic or mirror boundary conditions, set independently along each axis.
|
|
55
|
+
- One signed distance function `phi` per domain, positive inside, or optional coloring that stores domains that are not neighbors in shared fields to reduce memory use, with dynamic recoloring that prevents domains sharing a field from merging.
|
|
56
|
+
- Signed distance fields from pixel or voxel label arrays (for example grain maps from diffraction contrast tomography) with the methods 'EDT', 'FMM', 'FSM' and 'Brute'.
|
|
57
|
+
- Curvature driven evolution with explicit strong stability preserving Runge–Kutta schemes and an automatic time step.
|
|
58
|
+
- Interface mobility and energy as constants, fields or functions of the two domains and the interface normal, with neighbor identification at junctions, misorientation utilities (Read–Shockley energy, sigmoidal mobility) and 'Heterogeneous', 'Gradient' and 'Stiffness' (inclination dependent, 2D) formulations.
|
|
59
|
+
- Reinitialization by a second order reinitialization equation with subcell resolution ('PDE'), fast sweeping ('FSM'), fast marching ('FMM') or exact distances to the extracted interface ('Brute').
|
|
60
|
+
- Interaction correction of voids and overlaps by projection ('MBO', 'Losasso') or by source terms ('Lagrange' with a global multiplier, 'Source' with per domain weights). With an energy function, the 'Source' weights near junctions follow from the local pair energies, which reproduces the equilibrium junction angles and the junction speed of unequal energies (see example 02).
|
|
61
|
+
- Stored energy per domain as an additional driving force, so that domains grow into neighbors with higher stored energy, as in recrystallization.
|
|
62
|
+
- Advection of the interfaces by a prescribed velocity field, given as arrays or as a function of position and time, with first order upwind, second order ENO or fifth order WENO differences (with the weights of Jiang and Peng or, by default, of Borges et al.).
|
|
63
|
+
- A flag per domain stating whether its level set is evolved or immobile, for free surfaces, particles or inclusions, with a Neumann contact condition (zero normal derivative, so that interfaces meet immobile surfaces at 90 degrees) or a Dirichlet contact condition (interfaces pinned where they meet immobile surfaces).
|
|
64
|
+
- CPU or GPU execution and selectable floating point precision.
|
|
65
|
+
- Output of grid data (`.vti`), interfaces (`.vtp`) and time series (`.pvd`) for post-processing in software handling VTK-formatted files, and a pyLSET HDF5 format.
|
|
66
|
+
|
|
67
|
+
## Installation
|
|
68
|
+
|
|
69
|
+
From the repository folder:
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
pip install -e .
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Optional dependencies are installed with `pip install -e ".[fmm]"` (scikit-fmm for the 'FMM' method), `".[edt]"` (a faster multilabel EDT), `".[mesh]"` (Gmsh for `mesh_domain()`), `".[test]"` and `".[docs]"`.
|
|
76
|
+
|
|
77
|
+
## Quick start
|
|
78
|
+
|
|
79
|
+
```python
|
|
80
|
+
import pylset
|
|
81
|
+
|
|
82
|
+
sim = pylset.setup_simulation([128.0, 128.0], [128, 128], device_type='CPU', use_coloring=True)
|
|
83
|
+
labels = sim.do_voronoi_labels(60, seed=7) # or a grain map from experiments
|
|
84
|
+
sim.set_phi(sim.do_sdf(labels))
|
|
85
|
+
|
|
86
|
+
for step in range(1, 2001):
|
|
87
|
+
sim.do_step_update()
|
|
88
|
+
if step % 20 == 0:
|
|
89
|
+
sim.do_reinitialization()
|
|
90
|
+
sim.do_interaction_correction()
|
|
91
|
+
sim.do_reinitialization()
|
|
92
|
+
sim.do_recoloring()
|
|
93
|
+
|
|
94
|
+
sim.write_vtk_image('grains', [sim.get_phi_max(), sim.get_domain_map()], ['phi_max', 'grain_id'])
|
|
95
|
+
sim.write_vtk_interfaces('grain_boundaries')
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
See `examples/` for Jupyter notebooks and `docs/` for the documentation, which is built with `mkdocs serve`.
|
|
99
|
+
|
|
100
|
+
## Tests
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
python -m unittest discover -s tests -v
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
The tests run on the CPU by default. Set `PYLSET_TEST_DEVICE=gpu:1` to run them on GPU 1 and `PYLSET_TEST_DTYPE=float32` for single precision.
|
|
107
|
+
|
|
108
|
+
## License
|
|
109
|
+
|
|
110
|
+
pyLSET is distributed under the GNU General Public License v3.0 or later. See `LICENSE`.
|
|
111
|
+
|
|
112
|
+
## References
|
|
113
|
+
|
|
114
|
+
Further details on level set modeling and example applications can be found in:
|
|
115
|
+
|
|
116
|
+
- [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](https://doi.org/10.1088/1361-651X/ada818)
|
|
117
|
+
- [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](https://doi.org/10.1016/j.commatsci.2024.113284)
|
|
118
|
+
- [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](https://doi.org/10.1088/1361-651X/ab0c6c)
|
|
119
|
+
- [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.](https://doi.org/10.1007/s11661-017-4210-y)
|
|
120
|
+
- [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](https://doi.org/10.1016/j.jmps.2016.02.026)
|
|
121
|
+
- [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](https://doi.org/10.1016/j.jnucmat.2015.06.052)
|
|
122
|
+
- [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](https://doi.org/10.1088/0965-0393/22/8/085005)
|
|
123
|
+
- [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](https://doi.org/10.1088/0965-0393/21/8/085012)
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
pylset.py,sha256=svDeh3tQIt3dpI3-ZPmjNbjrghGn7aIIBuViagK_wbE,147299
|
|
2
|
+
pylset_base.py,sha256=RNwbA2xThqmVsJdOXRi9430JF38zse1i3Azz7ubTttc,50460
|
|
3
|
+
pylset_grid.py,sha256=Sxd8RIXybC_NNHsgltr5kHb3oaZoSv8esxhIU-eygYw,7138
|
|
4
|
+
pylset_io.py,sha256=nY-nqrxc9PaO-GNxpLve6ksncv-24xeNhKjVlNd06y4,40472
|
|
5
|
+
pylset_mesh.py,sha256=KP01kvxVhT8VOCounC-AuCxMSHf_3yAiZeRQmU00QX0,885
|
|
6
|
+
pylset_pre.py,sha256=uBh5vCvfjcCLvxySr91cVsAyjHgUCeYnrNGFSOsr9zU,40392
|
|
7
|
+
pylset-0.0.1.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
|
8
|
+
pylset-0.0.1.dist-info/METADATA,sha256=sdp6Pb9K4uwt9GLxcQ7KK_2p-pkFTCbDyKriK5XDbH4,8225
|
|
9
|
+
pylset-0.0.1.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
|
|
10
|
+
pylset-0.0.1.dist-info/top_level.txt,sha256=LzwjLRHyxprAIQ_tHqI7oyP5Y1RSCWb5CSDvwm8Errc,64
|
|
11
|
+
pylset-0.0.1.dist-info/RECORD,,
|