Hostname: page-component-74656f9884-rdgjk Total loading time: 0 Render date: 2026-11-07T00:41:57.872Z Has data issue: false hasContentIssue false

Machine-learning-based models in particle-in-cell codes for advanced physics extensions

Published online by Cambridge University Press:  07 December 2022

Chiara Badiali*
Affiliation:
GoLP/Instituto de Plasmas e Fusão Nuclear, Instituto Superior Técnico, Universidade de Lisboa, 1049-001 Lisbon, Portugal
Pablo J. Bilbao
Affiliation:
GoLP/Instituto de Plasmas e Fusão Nuclear, Instituto Superior Técnico, Universidade de Lisboa, 1049-001 Lisbon, Portugal
Fábio Cruz
Affiliation:
GoLP/Instituto de Plasmas e Fusão Nuclear, Instituto Superior Técnico, Universidade de Lisboa, 1049-001 Lisbon, Portugal Inductiva Research Labs, Rua da Prata 80, 1100-420 Lisboa, Portugal
Luís O. Silva*
Affiliation:
GoLP/Instituto de Plasmas e Fusão Nuclear, Instituto Superior Técnico, Universidade de Lisboa, 1049-001 Lisbon, Portugal
*
Rights & Permissions [Opens in a new window]

Abstract

In this paper we propose a methodology for the efficient implementation of machine learning (ML)-based methods in particle-in-cell (PIC) codes, with a focus on Monte Carlo or statistical extensions to the PIC algorithm. The presented approach allows for neural networks to be developed in a Python environment, where advanced ML tools are readily available to proficiently train and test them. Those models are then efficiently deployed within highly scalable and fully parallelized PIC simulations during runtime. We demonstrate this methodology with a proof-of-concept implementation within the PIC code OSIRIS, where a fully connected neural network is used to replace a section of a Compton scattering module. We demonstrate that the ML-based method reproduces the results obtained with the conventional method and achieves better computational performance. These results offer a promising avenue for future applications of ML-based methods in PIC, particularly for physics extensions where a ML-based approach can provide a higher performance increase.

Information

Type
Research Article
Copyright
Copyright © The Author(s), 2022. Published by Cambridge University Press
Figure 0

Figure 1. Schematic representation of data acquisition, ML model training and production workflow. The ML model is loaded in production simulations during runtime using the FKB and interpreted with the neural-fortran microframework within PIC.

Figure 1

Figure 2. (a) Depiction of the inputs of the NN during the training process: $\boldsymbol {p}_e$ and $\boldsymbol {p}_\gamma$ are the three momenta of the macroparticles undergoing collisional process, $w_e$ and $w_\gamma$ are their numerical weights and $P_{\max }$ is the maximum probability of interaction in each PIC cell. Finally, the target $y$ constitutes the probability of interaction according to an analytical model and $y'$ is the prediction of the NN. (b) Loss score, i.e. the mean absolute error (MAE) and mean absolute percentage error (MAPE), as accuracy for training and validation data as a function of the training epoch for the training data with $p_0 = 25\ m_e c$.

Figure 2

Figure 3. Probability of interaction estimated for the no-time-counter method as a function of the incoming photon energy colliding head on with an electron with momentum $p_e =$ (a1) $5$, (b1) $25$ and (c1) $50 m_e c$. The estimate calculated by OSIRIS (blue) and the prediction by NN module for OSIRIS (red) are directly compared and their relative error is shown in (a2–c2).

Figure 3

Figure 4. (a) Scattered photon momentum distribution resulting from inverse Compton scattering with an electron beam with momentum $p_e$. The three peaks correspond to three initial monoenergetic electron beams with $p_e = 25$, $50$ and $100\ m_e c$ (identified with dash-dotted, dashed and solid lines, respectively) interacting with a monoenergetic photon gas with energy $2.5 m_e c^2$. For each photon beam energy, the NN module for OSIRIS prediction (red) is plotted against the results from the conventional algorithm (black). (b) Scattered photon momentum distribution from inverse Compton scattering between an electron beam with $p_e / m_e c = 100$ and a monoenergetic photon gas with energy $\varepsilon _\gamma / m_e c^2 = p_\gamma / m_e c = 2.5$. Different model predictions at different TL stages are plotted (blue, grey and red) against results obtained with the conventional Compton scattering algorithm in OSIRIS (black).

Figure 4

Figure 5. (a) Comparison of the elapsed time during the complete collision list generation algorithm. (b) Comparison of the elapsed time for the inference of the collision probability and for the NN case the input preparation is also plotted. The time is normalized with respect to the time taken for the conventional approach with particles per collision cell $=1$.