Skip to content

berceanu/openPMD-resampler

Repository files navigation

Resampler Logo

:electron: openPMD-Resampler

Resampling tools for openPMD PIC data

💡 Motivation

We often need to post-process the particle data from a PIC simulation, and pass it to additional tracking codes like GEANT, GPT, SIMION or Wake-T. The original dataset can correspond to several billion particles, so one needs to reduce it to a manageable size, while conserving the main features of the underlying physics. This repository implements several resampling methods from the literature [2], as well as a comprehensive suite of high-resolution visualization tools, based on Datashader.

🚀 Installation

We make use of the excellent pixi package manager, which can be installed on Linux/macOS via

$ curl -fsSL https://pixi.sh/install.sh | bash

One can then clone this repo via

$ git clone git@github.com:berceanu/openPMD-resampler.git

📖 Usage

For an overview of the main functionality, see the usage.py example script and its output. For production runs, use

$ cd openPMD-resampler
$ pixi run start --opmd_path <path_to_your_openPMD_file> --species <electron_species_name> --reduction_factor <k>

Replace descriptions between chevrons <> by relevant values, in this case the path to the PIC output file, name of the electron species (e_all or e_highGamma etc.) and an integer reduction factor k, typically between 2 and ~100. If the initial PIC file has N macroparticles, the resulting reduced file will have N/k macroparticles.

If you need a sample PIC output file for testing, you can download lwfa.h5 [212M].

The code works with openPMD-compatible PIC codes, such as WarpX, PIConGPU, fbpic, etc.

The runtime is typically a few minutes and the memory footprint is about twice the size of the input file.

The output is a CSV text file, of the following form:

position_x_um (μm), position_y_um (μm), position_z_um (μm), momentum_x_mev_c (MeV/c), momentum_y_mev_c (MeV/c), momentum_z_mev_c (MeV/c)
1.1201412540356980e+01,8.0062201241442832e-01,3.9551004545608885e+03,-9.1752357482910156e+00,-1.4616233825683594e+01,2.9899465942382812e+02
...

🔧 Development

All project dependencies are listed under pixi.toml. Just create a fork, follow the install instructions and start making PRs.

⚛️ GEANT4

For a computational estimate, here is a quote from Ref. [1]:

The computer system for GEANT4 simulation is made up of Intel Quad-core 2.66 GHz CPU and 12 GB DDR3 RAM and OS is Ubuntu 9.04 server version. It took about 3~4 hours to simulate with $10^7$ primary particles.

📚 References

[1] Park, Seong Hee, et al. "A simulation for the optimization of bremsstrahlung radiation for nuclear applications using laser accelerated electron beam." Proceedings of FEL2010, Malmö, 2010. PDF

[2] Muraviev, A. et al. "Strategies for particle resampling in PIC simulations." Comput. Phys. Commun. 262, 107826 (2021). DOI

[3] Shimazaki, Hideaki, and Shigeru Shinomoto. "A method for selecting the bin size of a time histogram." Neural computation 19.6, 1503 (2007). DOI

📢 Acknowledgements

We would like to acknowledge useful discussions with Richard Pausch (HZDR).

🔗 Similar Projects

Releases

No releases published

Packages

No packages published

Languages