ComputationalRadiationPhysics / clara2

Clara2 - a parallel classical radiation calculator based on Liénard-Wiechert potentials
GNU General Public License v3.0
13 stars 9 forks source link

Analyze openPMD-compliant hdf5 trajectory data #111

Open berceanu opened 5 years ago

berceanu commented 5 years ago

Hi guys,

Before jumping into PIConGPU + radiation plugin for betatron studies, I am doing a quick parameter scan via fbpic. Do you think it would be possible to analyze the resulting .h5 files via clara2 and if so, could you please give me some pointers on how to get started?

berceanu commented 5 years ago

Also, on a more general note, would the FFT approach be suitable for LWFA-induced betatron (i.e., have you guys tried it), or would I have to switch to the DFT mode? It seems that FFT is more targeted at undulator-type scenarios.

berceanu commented 5 years ago

I should perhaps also note that I intend to run this on a single multi-core machine, at least for now.

PrometheusPi commented 5 years ago

Hi @berceanu,

cool that you are planning to use clara2 now.

In general, clara2 needs trajectories, currently as simple text files as e.g., GPT provides. (However, you could extend it to read hdf5 as well.) As long as you have the trajectory data for close time steps (ideally each time step of a PIC simulation.)

In order to convert your hdf5 data to a text-based trajectory, please save each particle in a separate file with a number so that it can be read automatically via this regex: here in settings.hpp

If you do not want to change the internal order, each column should contain one property: here

1st: x-position [m]
2nd: y-position [m]
3rd: z-position [m]
4th: beta_x = v_x/c
5th: beta_y = v_y/c
6th: beta_z = v_z/c
7th: time [s]

You can also adjust the units to get them to SI units here.

If you adjusted settings accordingly to your needs (frequency: number and maximum frequency; observation direction: number, theta_max and phi values; and number of trajectories: number).

Then compile the code via the make script.

Ideally, you keep a copy of the source code and binary for each ensemble of trajectories you analyses. (The data output is not yet self-documented, so that keeping the setting allows you to understand the output afterward.)

After your simulation finished, run the program process (compiled with the make process) on the data, in order to get easy to read text-based output of (incoherently added) total spectrum.

Regarding parallelization: This is an embarrassingly parallel MPI process. There is no need for interprocess communication. So if you want to run it with fewer ranks (or a single one), it will just take longer.

PrometheusPi commented 5 years ago

Regarding your question with betatron radiation: See issue #109 Setting param::fft_length_factor to a high value (e.g., 256) allows you to sample the non-equidistant retarded time fine enough to avoid under-sampling artifacts as common in wiggler or betatron scenarios.