Using BMXYZ for tracking through a periodic quadrupole

Moderators: cyao, michael_borland

Post Reply
samira.fatehi
Posts: 2
Joined: 03 Dec 2021, 12:39
Location: Karlsruhe, Germany
Contact:

Using BMXYZ for tracking through a periodic quadrupole

Post by samira.fatehi » 13 Mar 2024, 09:47

Dear Michael,
I have a periodic quadrupole magnet and I am tracking the 400 MeV electron beam through the 3D magnetic field map using Astra, BMAD, and ELEGANT.

- In ELEGANT, BMXYZ and Ftable commands provide consistent results, but the intermediate Twiss parameters within the magnet are missed. As I am also interested in the Twiss parameters inside the magnet, I tried to divide the field map into 10 sub-field maps but it seems that does not work well. Is there any way to ask the code for calculating the Twiss parameters inside the magnet?

- Unfortunately, there's a discrepancy between the results obtained from Astra/BMAD and those from ELEGANT, leaving me uncertain about which set of results to trust or report. Could you please have a look at the files I uploaded to see if they are written accurately or if there could be a modification?

Thanks for your time in advance,
Best regards,
Samira Fatehi.
Attachments
PQ.zip
(6.48 MiB) Downloaded 190 times

michael_borland
Posts: 1959
Joined: 19 May 2008, 09:33
Location: Argonne National Laboratory
Contact:

Re: Using BMXYZ for tracking through a periodic quadrupole

Post by michael_borland » 29 Mar 2024, 15:01

Samira,

The problem seems to be that your field file does not define a quadrupole magnet. To check this, I computed dBy/dx at y=0 and dBx/dy at x=0 as a function of z.

Code: Select all

sddssort fieldmap300.sdds -pipe=out -col=z -col=x -col=y | sddsbreak -pipe -change=z | sddsprocess -pipe -filter=col,y,-1e-6,1e-6 -process=By,slope,BySlope,functionOf=x -process=z,first,z | sddscollapse -pipe=in BySlopeVsZ.sdds
sddssort fieldmap300.sdds -pipe=out -col=z -col=x -col=y | sddsbreak -pipe -change=z | sddsprocess -pipe -filter=col,x,-1e-6,1e-6 -process=Bx,slope,BxSlope,functionOf=y -process=z,first,z | sddscollapse -pipe=in BxSlopeVsZ.sdds
sddsplot slopes -layout=1,2 -join=x  -sep=1 -col=z,BySlope BySlopeVsZ.sdds -col=z,BxSlope BxSlopeVsZ.sdds
As you can see dBx/dy=dBy/dx, when they should have opposite signs.
slopes.png
I guess if you change Bx-> -Bx it would be a start.

--Michael

samira.fatehi
Posts: 2
Joined: 03 Dec 2021, 12:39
Location: Karlsruhe, Germany
Contact:

Re: Using BMXYZ for tracking through a periodic quadrupole

Post by samira.fatehi » 09 Apr 2024, 02:49

Dear Michael,

Thanks for your reply.
As you meant, the beam in a quadrupole focuses in one direction and defocuses in the other. This phenomenon arises from the forces acting on the beam, which are directed into or out of the magnet center, while the field gradient maintains the same sign in both the x and y directions, indicated by dBx/dy=dBy/dx.

I also referred to Helmut Wiedemann's book "Particle Accelerator Physics" fourth edition, page 104, for confirmation. According to the book, the magnetic field can be derived in Cartesian coordinates from the scalar potential V= -gxy. This yields,
-∂V/∂x = B_x = gy and -∂V/∂y = B_y = gx
Hence, I think, any disparities between codes should be attributed to other factors.

To define the issue more accurately, I should say, using the same field map I obtained β_x = 34 m , α_x = -25 , β_y = 130 m and α_y = 361 from BMAD and ASTRA at the end of the magnet structure while ELEGANT gives me β_x = 50.15 m , α_x = 0.27 , β_y = 100.84 m and α_y = 192.88.
Is there any way to track the beam and obtain (cross-check) the beam twiss parameters within the magnet?
Your further assistance is highly appreciated.
Sincerely,
Samira

Post Reply