bmad-sim / bmad-ecosystem

Bmad simulation ecosystem for simulating high energy storage rings.
https://www.classe.cornell.edu/bmad/
12 stars 15 forks source link

cartesian decomp term causing issues #539

Closed jeu8 closed 1 year ago

jeu8 commented 1 year ago

I am adding a gradient term to a wiggler using cartesian decomposition. No matter the size of this term I get an error about particle loss. Setting the term to 0 also gives the error. Only including the main wiggler term works.

File is at /nfs/acc/temp/jeu8/test

The file includes a working wiggler and a wiggler with the gradient term

DavidSagan commented 1 year ago

@jeu8 Problem is that kz = 0 and this makes the vector potential (which PTC uses for the tracking) infinite (see section 24.22 of the Bmad manual). I will work on putting in code to catch this and generate an error message. The simple workaround is to make kz finite (anything greater than 1e-100).

jeu8 commented 1 year ago

I have tried this fix, but if kz is very small I get the same error. I have to make it ~1 to not have an error, but this is too large to approximate a constant gradient over my 4m wiggler. Do you see this as well?

DavidSagan commented 1 year ago

@jeu8 If I lower the amplitude from 2.4 to 0.2 everything is fine.

jeu8 commented 1 year ago

I changed the file to reflect what was found out in the meeting. I have the amplitude set to the value it needs for the proper focusing, 1/sqrt(2)*2.4. this still gives an error