openPMD / openPMD-viewer

:snake: Python visualization tools for openPMD files
https://openpmd-viewer.readthedocs.io/
Other
65 stars 49 forks source link

Openpmd format for Ocelot tracking code #381

Closed zhangli28 closed 11 months ago

zhangli28 commented 1 year ago

Dear Developers,

I recent came to know that the particle tracking code OCELOT can read openpmd data format (https://github.com/ocelot-collab/ocelot/commit/55d485d19ab7e9c3e92c09484588aa85b35a7a13).

This is a nice combination of PIC and then tracking of particles in beam line.

I am wonder if you have ever tried to use FBPIC or WarpX output data file to read in Ocelot ?

This may be interesting for many users.

Thanks.

RemiLehe commented 1 year ago

Thanks for pointing this out. I don't know of anyone using Ocelot in combination with FBPIC or WarpX (we usually use ImpactX for tracking), but it should definitely be possible, as you pointed out. If you try doing so, feel free to post any questions you may have in the process :)

soerenjalas commented 1 year ago

@AngelFP might have some insights.

AngelFP commented 1 year ago

I have done this with FBPIC+Ocelot and Wake-T+Ocelot. With Wake-T it is quite straightforward because because Ocelot already has built-in converters between the two codes (link) so that you don't even need to save the data to disk to couple them. With FBPIC, I read the particle data using this and then make an Ocelot ParticleArray by hand. It looks like the function you discovered could do this in one step.

zhangli28 commented 12 months ago

Thank you all (@RemiLehe @soerenjalas @AngelFP ) for help and sorry for late reply. I was struck in flood in my home town in august. @AngelFP mentioned that with Wake-T it is easy to convert in Ocelot. My question to @AngelFP is can it be possible to convert from FBPIC to Wake-T format because just 2 days ago I came to know from Andrei that Wake-T can also be used for particle tracking. @AngelFP can you help me to understand how I can use Wake-T to do particle tracking for beam transportation line using FBPIC simuation data.

AngelFP commented 11 months ago

Hi @zhangli28, sorry to hear about the flooding, I hope you were safe!

You can read an FBPIC beam into Wake-T using the following code:

from wake_t.utilities.bunch_generation import get_from_file

bunch = get_from_file(file_path='path/to/file.h5', data_format='openpmd', species_name='species_name')

For making a simulation of the transport line you can check the example here (which consists of a drift followed by a plasma lens), starting at Create beam capture section, since you don't need to simulate the LPA.

zhangli28 commented 11 months ago

Hi @AngelFP ,

thank you so much for your help. I will definitely check Wake-T and it further applications in combination with FBPIC.

Thanks to all of you great guys (@AngelFP @RemiLehe @soerenjalas).