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
54 stars 27 forks source link

importbeam "beamletsize" error when !=16 #85

Closed gtiwari30 closed 11 months ago

gtiwari30 commented 1 year ago

Using the &importbeam feature with importing particle beam distribution from a hdf5 file requires redundant setting of "beamletsize" value to 16 to run the code properly eventhough particle distribution might have been generated using a different nbins number. Is there a way to turn off this problem and use the proper value of nbins from the imported file? Thank you in advance.

Sincerely, Ganesh

svenreiche commented 1 year ago

This is by design. Setup should defines the basic properties of the simulations (reference wavelength, reference energy, type of beam loading, lattice etc). So having the check of the beamlet size in the dump with the input of the setup is there to be consistent and that the user is aware of the "backdoor" of importbeam, which has the potential to be quite disastrous if someone does not fully know how the code works internally. It is not so much for nbins, which is still quite harmless, but more of 'slicelength' in the dump which could also overwrite the input from setup. Changing the value there could mean that any timerecord or generation of the radiation field can be render wrong. It could be solved to enforce the importbeam early on in the input deck but then you can say the same for importfield. Therefore I decided to have the flexibility of the position of the namelists (to a certain degree) and rely on consistency checks.

Nevertheless it could be done but due to limited time it does not have a high priority.

gtiwari30 commented 1 year ago

Thank you for your comment. Setting nbins same as beamletsize from imported file resolves this issue. However, users may benefit from having nbins value updated from beamletsize of the imported file to bypass this redundancy.