You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am facing something strange.
I set b1 to some value in a quad (or sextupole).
The orbit generated is of opposite sign of what is expected.
In the vertical plane this is fine.
I add the testing code using ESRF lattice.
Please let me know if you confirm the bug or if I am doing something wrong.
Hello, the sign convention is different in horizontal and vertical in AT.
A positive PolynomA(1) gives a positive kick in y', a positive PolynomB(1) gives a negative kick in x'.
This is a piece of code from driftkick.c, where there is a minus sign where the horizontal kick is applied.
static void strthinkick(double* r, const double* A, const double* B, double L, int max_order)
/*****************************************************************************
Calculate and apply a multipole kick to a 6-dimentional
phase space vector in a straight element (quadrupole)
IMPORTANT !!!
The reference coordinate system is straight but the field expansion may still
contain dipole terms: PolynomA(1), PolynomB(1) - in MATLAB notation,
A[0], B[0] - C,C++ notation
******************************************************************************/
{
int i;
double ReSum = B[max_order];
double ImSum = A[max_order];
double ReSumTemp;
for (i=max_order-1; i>=0; i--) {
ReSumTemp = ReSum*r[0] - ImSum*r[2] + B[i];
ImSum = ImSum*r[0] + ReSum*r[2] + A[i];
ReSum = ReSumTemp;
}
r[1] -= L*ReSum;
r[3] += L*ImSum;
}
This is not a bug but a consequence of the field expansion in AT. You can think of a “standard” bending magnet : it bends to the right (negative angle), while if you rotate it by 90 deg. It bends to the top (positive vertical angle). So definitely, as noted by @carmignani:
Positive B1 means negative H angle
Positive A1 means positive V angle
Dear All
I am facing something strange.
I set b1 to some value in a quad (or sextupole).
The orbit generated is of opposite sign of what is expected.
In the vertical plane this is fine.
I add the testing code using ESRF lattice.
Please let me know if you confirm the bug or if I am doing something wrong.
%% ESRF Lattice
Ring=esrf;
[LinData,nu, ksi] = atlinopt(Ring,0,1:length(Ring)+1)
beta = cat(1,LinData.beta);
phase= cat(1,LinData.mu);
eta = cat(2,LinData.Dispersion)';
spos = cat(1,LinData.SPos);
Id = 6;
theta = 1e-4;
orb_ana = (sqrt(beta(Id,1)beta(:,1))/2/sin(pinu(1)).cos(abs(phase(Id,1)-phase(:,1))-pinu(1))-eta(Id,1)*eta(:,1)/mcf(Ring)/LinData(end).SPos)*theta;
Ring{Id}.PolynomB(1)=theta/Ring{Id}.Length;
cod = getcod(Ring);
cod = cod';
figure(400)
clf
subplot(2,1,1)
plot(spos, orb_ana); hold all;
plot(spos, cod(:,1),'k*');
legend('Analytical', 'AT')
ylabel('horizontal orbit')
orb_ana2 = (sqrt(beta(Id,2)beta(:,2))/2/sin(pinu(2)).cos(abs(phase(Id,2)-phase(:,2))-pinu(2))-eta(Id,3)*eta(:,3)/mcf(Ring)/LinData(end).SPos)*theta;
Ring=esrf;
Ring{Id}.PolynomA(1)=theta/Ring{Id}.Length;
cod = getcod(Ring);
cod2 = cod';
subplot(2,1,2)
plot(spos, orb_ana2); hold all;
plot(spos, cod2(:,3),'k*');
legend('Analytical', 'AT')
ylabel('vertical orbit')
The text was updated successfully, but these errors were encountered: