Hi,
I get a problem due to my unusually high energy spread. In short, the program gives different output for beam sizes, emittances, etc., depending on which central energy I set, even though I rescale the magnet strengths to correspond to the same gradient. Below is more info about my setup and problem, I hope I can get it to make sense.
I am currently designing a beam transport lattice for a laser-wakefield electron accelerator, for which the energy spread can vary a lot depending on injection method. Right now, I am using an input file from a PIC simulation for a certain injection method which gives a lot of charge but also a high energy spread; the spectrum that I have goes from 0-380 MeV, but I only track 70-380 MeV.
The lattice is very simple at the moment, consisting of a permanent quadrupole (PMQ) triplet, an intermediate drift, and then an electromagnet quadrupole (EMQ) triplet to refocus. I have made several different profiles for focusing different energies in the beam by matching the beta functions from the PMQs, which will only focus some nominal energy, with the EMQs. The lattice config I made in the tool OPA, where I "modeled" a higher energy by rescaling the PMQ strengths from, say, k = 400 to k = 200 when going from 100 to 200 MeV and then matching the new beta functions with the EMQs to obtain a focus at the end. For the tracking in elegant, I put in these same magnet parameters in the lattice file and scaled the central energy (p_central), one profile for each energy.
This should mean that when I go between different profiles and energies, the EMQ triplet should have the same effect on the beam (the gradient should be the same) since I use the same input file every time. What I see, though, is that pretty much every single beam parameter changes along the lattice when I change the energy. I haven't looked in the source code, I'm not very good at coding, but to me it looks like there is some expansion around the central energy which is insufficient when it comes to handling energy ranges this wide. I also see this effect when running with an auto-generated bunch with ~0 energy spread but where the central bunch energy is different from p_central.
Is there some setting that I should change or is this a feature in the program? I have tried both regular quads with matrices and kquads with symplectic integration, everything with lots of element divisions and number of kicks (26 and 32 respectively), and I get the same effect.
I hope this was understandable.
Best regards
Jonas
Tracking with large energy spread
Moderators: cyao, michael_borland
-
- Posts: 2008
- Joined: 19 May 2008, 09:33
- Location: Argonne National Laboratory
- Contact:
Re: Tracking with large energy spread
Jonas,
I did a test and don't see a problem. Please see my files in the attachment.
If you continue to have a problem, please upload a set of files that illustrate the issue.
Thanks--Michael
I did a test and don't see a problem. Please see my files in the attachment.
If you continue to have a problem, please upload a set of files that illustrate the issue.
Thanks--Michael
- Attachments
-
- largeEnergySpread.zip
- (2.4 KiB) Downloaded 356 times
Re: Tracking with large energy spread
Hi Michael,
Thanks for the reply!
I have put together a shorter version of my .lte and .ele files for you, see attachment 1. When I run these and look at the sigma values, these change between different runs, see images in attachment 2. What I have changed between these runs is p_central and also what lattice profile I use, but these profiles should correspond to the same gradient (~167 T/m), since I have scaled the k-value accordingly. Normally, I would also have included my second q-pole triplet in the lattice file, but I left them out for the sake of simplicity.
Best regards
Jonas
Thanks for the reply!
I have put together a shorter version of my .lte and .ele files for you, see attachment 1. When I run these and look at the sigma values, these change between different runs, see images in attachment 2. What I have changed between these runs is p_central and also what lattice profile I use, but these profiles should correspond to the same gradient (~167 T/m), since I have scaled the k-value accordingly. Normally, I would also have included my second q-pole triplet in the lattice file, but I left them out for the sake of simplicity.
Best regards
Jonas
- Attachments
-
- Images.zip
- (31.29 KiB) Downloaded 383 times
-
- Elegant.zip
- (1.43 KiB) Downloaded 362 times
-
- Posts: 2008
- Joined: 19 May 2008, 09:33
- Location: Argonne National Laboratory
- Contact:
Re: Tracking with large energy spread
Jonas,
I think the only problem is that you are using QUADRUPOLE elements, which are based on a third-order matrix expansion. This isn't good enough for extremely large momentum offsets. If you use KQUAD instead, you should see essentially perfect agreement. See attached.
--Michael
I think the only problem is that you are using QUADRUPOLE elements, which are based on a third-order matrix expansion. This isn't good enough for extremely large momentum offsets. If you use KQUAD instead, you should see essentially perfect agreement. See attached.
--Michael
- Attachments
-
- triplet.zip
- (1.96 KiB) Downloaded 356 times
Re: Tracking with large energy spread
Michael,
All right! I had already tried with kquad and gotten the same result as with the regular matrix function - I was quite surprised since I was kind of expecting the kquad function to solve the problem. Maybe there was some kind of error message that I didn't see which just gave me the old values again. I will try again tomorrow and report back what I get, but it looks promising.
Thanks!
//Jonas
All right! I had already tried with kquad and gotten the same result as with the regular matrix function - I was quite surprised since I was kind of expecting the kquad function to solve the problem. Maybe there was some kind of error message that I didn't see which just gave me the old values again. I will try again tomorrow and report back what I get, but it looks promising.
Thanks!
//Jonas
Re: Tracking with large energy spread
Hi again Michael,
So I ran it again and everything looks fine, just like in your plots
Something must have gone wrong when I tried it before.
Now, the plots look quite different from those I got with the matrix elements, but I assume that kquad gives a more realistic behavior. Will using more kicks provide a "better" result (with the trade-off of computational time)?
Many thanks
//Jonas
So I ran it again and everything looks fine, just like in your plots

Now, the plots look quite different from those I got with the matrix elements, but I assume that kquad gives a more realistic behavior. Will using more kicks provide a "better" result (with the trade-off of computational time)?
Many thanks
//Jonas
-
- Posts: 2008
- Joined: 19 May 2008, 09:33
- Location: Argonne National Laboratory
- Contact:
Re: Tracking with large energy spread
Jonas,
KQUAD is expected to give much more accurate results than the matrix-based QUAD element. As you guessed, this is particularly the case when you increase the N_KICKS parameter. The downside is that KQUAD is slower, but you can use the parallel version (Pelegant) to partially compensate for the longer running times when tracking many particles.
--Michael
KQUAD is expected to give much more accurate results than the matrix-based QUAD element. As you guessed, this is particularly the case when you increase the N_KICKS parameter. The downside is that KQUAD is slower, but you can use the parallel version (Pelegant) to partially compensate for the longer running times when tracking many particles.
--Michael