svenreiche / Genesis-1.3-Version4

Time-dependent, 3D Code to simulate the amplification process of a Free-electron Laser.
GNU General Public License v3.0
53 stars 26 forks source link

[ISSUE] Importing Genesis beam fails in harmonic conversion #155

Open eugenioferrari opened 7 months ago

eugenioferrari commented 7 months ago

Hello, Similar to what was happening with the field file, when doing an HGHG run and harmonic conversion without resampling, something similar happens when trying to import a particle file.

This is the error reported: *** Error: Mismatch in sample rate of run and of input file

While I experience this with single slice simulations, I suspect the same issue is present in multislices.

ZeugAusHH commented 7 months ago

Dear Eugenio,

which version of GENESIS are you running? If possible please provide the version number -- or even better, the git commit id of the source code used to build the binary.

Best Christoph

eugenioferrari commented 7 months ago

Dear Christoph, I'm on the commit #9f9f00f.

Best Eugenio

ZeugAusHH commented 7 months ago

Dear Eugenio,

thanks for posting the commit id, I was asking since I recently improved the error handling code in imports of fields/beams. But since you're on the most recent commit, I think @svenreiche needs to take over.

Best Christoph

eugenioferrari commented 6 months ago

Thank you for looking into this. Attached you can find a minimal working example of the issue.

example_issue.zip

And here is the error message:

Opened input file input_rad.in
Parsing lattice file lattice.lat ...
Setting up time window of 0.004 microns with 1 sample points...
Generating input radiation field for HARM = 1 ...
Importing particle distribution from file: modulated.par.h5 ...
*** Error: Mismatch between reference length of run and of input file

Program is terminating...
eugenioferrari commented 6 months ago

As suggested by @svenreiche, the issue is due to the discrepancy in the sampling rate. It can be solved by invoking an harmonic conversion via alter_setup before the actual tracking.

Thanks again!

svenreiche commented 6 months ago

Actually it is not that trivial. I tried to do it with alter_setup but then I am getting an error message. This time with the sample rate, since the dump has a sample rate of 75. SO there is still some need to fix it.

eugenioferrari commented 6 months ago

Works for me when resample=false

svenreiche commented 6 months ago

Yes, I made it also work with setting explicit the sample to 75 in the second file for the time-window (resample should be per default false).
The problem is more for steady-state simulation, since the dumped beam file still has a difference between reference length and slice length by 75. And that is not easy to define in the second run if it is also steady-state.
So that needs to be fixed and I keep the issue open still in steady-state the sample rate is not changed.

eugenioferrari commented 6 months ago

Another point: it's also not working if the harmonic conversion is done in the modulator file, before the particle dump.