-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rotation of dipoles #781
Comments
Dear Teresia, Best Regards, |
Hi Elaf, Yes, that is what I think. Like you, I also got a tiny impact in the simulation but in our measurement where we went into the tunnel and physically realigned the magnet we could see a bigger impact. We did a quick calculation of how we expected the magnetic fields to change due to the realignment and that seemed to agree well with what we measured. If I understood the paper from @simoneliuzzo correctly, the reason is because the dipoles also are setting the reference orbit. So when we change the rotation using the method in I think Elegant does something similar. In Elegant the element So I think it's the equivalent of setting the |
Dear @TeresiaOlsson , I have checked the function
I suspect the problem comes from the calculation of R1,R2,T1,T2, which depend on the bending magnet length, angle and point where the rotation is applied. This is still not solved in pyat, but, for short bendings, small angles and rotations around the longitudinal midpoint of the bending magnet the result should still be ok. When the bending magnet is long, the angle is not small or you need to rotate around the entrance face instead of the center there is a Matlab routine created by Thorsten Hellert that I have checked in several cases and it has given me good results. The function is called Here is a short example of how to use it dx = 1e-3;
dy = 0;
dz = 0; % opposite sign to the sixth particle coordinate
atilt = 0.0;
apitch = 0.0;
ayaw = 0.0;
ax = apitch;
ay = ayaw;
az = atilt;
magTheta = 2*pi/4;
magLength = 0.8;
%[T1,T2,R1,R2] = SCgetTransformation(dx,dy,dz,ax,ay,az,magTheta,magLength,'refPoint','entrance');
[T1,T2,R1,R2] = SCgetTransformation(dx,dy,dz,ax,ay,az,magTheta,magLength,'refPoint','center'); Then you will need to put those T1,T2,R1,R2 fields in your element. |
Okay, thank you. I have long bending magnets (the main dipoles) so that could explain it. Have you also at some point tested the It feels a bit dangerous to me to have a separate implementation for dipoles which changes other fields like |
Dear @TeresiaOlsson @elafmusa and @oscarxblanco , I forgot I wrote that paper! |
Dear @TeresiaOlsson, pySC implements the same physics as SC (mentioned by @oscarxblanco ): https://github.com/lmalina/pySC/blob/master/pySC/utils/sc_tools.py#L115 The function Cheers, |
This is great! I will test that with our measurement results. |
Dear @TeresiaOlsson, @oscarxblanco, @lmalina and @elafmusa, it is not clear to me how T1, T2, R1, R2 can actually do anything for a dipole. To my understanding for AT a dipole does "nothing". It is a drift space. Mainly the bending angle is used to compute the survey/layout and radiation (not sure) that's all. atsettilt does set R1/R2 but with zero effect, correctly, the modified parameter is the reference survey, so no closed orbit distortion visible. If you ask atgeometry3 there you should notice (hopefully, but not sure) a non closed ring. |
Dear @oscarxblanco, I do not see why the K of a dipole is relevant. hopefully, if there is a K the alignment errors set wit T1T2 R1R2 will give you misaligned quadrupole effects. However here I think we want to see the errors introduced by dipoles only. So I assume dipole K=0. It is strange that the dispersion is not changing with
The figures are: dispersion no tilt deviation of dispersion and cod: I have an issue with the atgeometry3 output (all nan for my lattice...). atsettiltdipole has been explicitly written to avoid changes in survey and to see closed orbit and dispersion modulation instead. It should not drive any change in survey. So your figure is unexpected for me. |
I'm a bit confused now and need to do more thinking but I think for the specific user case I'm interested in, I want what
To compare that, I guess I need the reference orbit to remain the same? So I don't want the survey to change? |
Dear @simoneliuzzo, I just saw a typo in my script. Dispersion
0.132710740981170 0.000013268899828 -0.000000000000000 0
Dispersion atsettiltdipole
0.132583873848275 0.000007105408571 0.002759006675413 0.000453692275293
Dispersion atsettilt
0.132710163182893 0.000013370824182 0.000945652628255 -0.000045650207821
Dispersion SCgetTransfomation
0.132591362966804 0.000007372277885 0.002712896010740 0.000442537246892 My typo was in this line:
|
@simoneliuzzo , wrt to K=0, I agree. The nominal trajectory inside a bend is an arc. If you tilt the magnet (rotation around s) centered on the mid point, you will create offsets on the entry and end faces, i.e. a rotation on a curved element requires R1,R2 and also T1, and T2.
|
Dear @simoneliuzzo , As you said ...
plot(cat(1,geo4.z),'DisplayName','RING SCgetTransformation','LineWidth',2,'LineStyle','-.','Color','k');
...
|
@oscarxblanco In my case I have no higher components in the dipoles, but for combined function magnets I can see that this is an issue. So for your example it looks like you get the same effect on the dispersion with I could have tested it myself, but unfortunately I currently don't have access to our matlab license server because of work our IT department is doing to restore our networks after the cyberattack last year. So temporarily I can't use matlab... |
Dear @TeresiaOlsson , here is a recipe based on the ALBA tests I had to do recently. Please, have a look a check what applies to your case. In order to compare the effect of the magnet offset you will need:
The reason is that you want the displacement to be with respect to some stable configuration very close to what you can simulate. Now you intervene the machine physically realigning some elements...
P.S. |
Dear @TeresiaOlsson, %%
NN = length(THERING);
o1 = findorbit6(NEWRING,1:NN);
o2 = findorbit6(NEWRING2,1:NN);
o3 = findorbit6(NEWRING3,1:NN);
o4 = findorbit6(NEWRING4,1:NN);
figure;yscale=1e3;
subplot(2,1,1);hold on;
plot(yscale*o1(1,:),'LineWidth',8,'DisplayName','RING');
plot(yscale*o2(1,:),'DisplayName','RING atsettiltdipole','LineWidth',6);
plot(yscale*o3(1,:),'DisplayName','RING atsettilt','LineWidth',4);
plot(yscale*o4(1,:),'DisplayName','RING SCgetTransformation','LineWidth',2,'LineStyle','-.','Color','k');
legend;grid;
xlabel('index');
ylabel('x [mm]');
subplot(2,1,2);hold on;
plot(yscale*o1(3,:),'LineWidth',8,'DisplayName','RING');
plot(yscale*o2(3,:),'DisplayName','RING atsettiltdipole','LineWidth',6);
plot(yscale*o3(3,:),'DisplayName','RING atsettilt','LineWidth',4);
plot(yscale*o4(3,:),'DisplayName','RING SCgetTransformation','LineWidth',2,'LineStyle','-.','Color','k');
xlabel('index');
ylabel('y [mm]');
grid; |
Thank you so much @oscarxblanco. That is really great! The tests you did at ALBA is also what we tried for BESSY II. The only difference I think is that we don't have any misalignments in our model yet so we can only look at difference orbits. I will try this as soon as I get my matlab license back and then see if I can get the same with pyAT and pySC. |
Hi,
We have done measurements of the orbit distortion and dispersion when realigning a dipole magnet and I wanted to compare to what our model in pyAT predicts. I used the
rotate_elem
function (including the changes that have been done since the last release), but the results made no sense. Then I discovered this very nice paper explaining that the reason for it might be because applying rotations to a dipole also changes the reference system.https://accelconf.web.cern.ch/ipac2017/papers/wepik061.pdf
Is there already a
atsettiltdipole
function in pyAT as in matlab AT or it has to be implemented? If I need to implement it, is there any reason to not add it directly to therotate_elem
function instead of having a separate function for dipoles?The text was updated successfully, but these errors were encountered: