Hi,
I am working on the simulation of a beam passing through waveguides, where the effect of wakefield is modeled using WAKE element.
My distribution is generated from a wellorder grid, where I carefully put required number of particles in each bin to avoid unwanted noises, as shown below
Depending on the number of bins, the histogram can be drastically different than its true histogram, as shown below
Since it is recommended to set n_bins=0 for WAKE element, is there a way that I can check the exact number of bins used in ELEGANT during the simulation ?
I would like to check if ELEGANT uses improper number of bins during the simulation.
Thanks.
n_bins in WAKE element
Moderators: cyao, michael_borland

 Posts: 79
 Joined: 20 Aug 2008, 13:18
 Location: Northern Illinois University & Argonne National Laboratory
 Contact:
Re: n_bins in WAKE element
All,
To further comment on Wei Hou's post, is there a way to dump the binned current distribution being used by ELEGANT in the wakefield calculation? Such a feature would be very helpful to have especially when the number of bins is automatically set by ELEGANT. This would also give an idea of how the filter affects the distribution (I think such a feature is available in the CSR calculations). Thank you,  Philippe.
To further comment on Wei Hou's post, is there a way to dump the binned current distribution being used by ELEGANT in the wakefield calculation? Such a feature would be very helpful to have especially when the number of bins is automatically set by ELEGANT. This would also give an idea of how the filter affects the distribution (I think such a feature is available in the CSR calculations). Thank you,  Philippe.

 Posts: 1811
 Joined: 19 May 2008, 09:33
 Location: Argonne National Laboratory
 Contact:
Re: n_bins in WAKE element
Output of the binned distributions is not available for the WAKE element. The number of bins used is Floor[(tmaxtmax)/dt + 3], where tmax (tmin) is the maximum (minimum) value of the t coordinate, and dt is the interval between time points in the wake input file. If your wake time spacing is small compared to the typical spacing of particles in time, you may well get some noisy results.
One way to reduce noise in the distributions is to use a Halton sequence to rather than random numbers. This also provides more randomlooking distribution that simpler deterministic methods of filling in the coordinates. The program sddssampledist allows sampling arbitrary distributions using Halton sequences. Combined with sddsmatchtwiss, it allows making fairly general beam distributions.
Michael
One way to reduce noise in the distributions is to use a Halton sequence to rather than random numbers. This also provides more randomlooking distribution that simpler deterministic methods of filling in the coordinates. The program sddssampledist allows sampling arbitrary distributions using Halton sequences. Combined with sddsmatchtwiss, it allows making fairly general beam distributions.
Michael