Hi Michael,
But how to determine the value of X? it is defined as XREFERENCE in the CSBEND element.
And by the way, if I want to check the parameters of a dipole after inserting the error, how can i printout this parameters? For example, the skew strength of quadrupole field in the CSBEND.
Thanks,
Zhilong
Multiple error of dipole, Quadrupole, and sextupole in ELEGANT
Moderators: cyao, michael_borland

 Posts: 1797
 Joined: 19 May 2008, 09:33
 Location: Argonne National Laboratory
 Contact:
Re: Multiple error of dipole, Quadrupole, and sextupole in ELEGANT
Zhilong,
Are you asking how to determine the value of the reference radius for KQUAD and KSEXT? If so, that's done via the referenceRadius parameter in the multipole input files. See the KQUAD entry in the manual.
The error log file will give you the values of the multipole errors generated for CSBEND elements. You can request this file as part of the &error_control command. For KQUAD and KSEXT, unfortunately, the random errors are not externally accessible at present.
Michael
Are you asking how to determine the value of the reference radius for KQUAD and KSEXT? If so, that's done via the referenceRadius parameter in the multipole input files. See the KQUAD entry in the manual.
The error log file will give you the values of the multipole errors generated for CSBEND elements. You can request this file as part of the &error_control command. For KQUAD and KSEXT, unfortunately, the random errors are not externally accessible at present.
Michael
Re: Multiple error of dipole, Quadrupole, and sextupole in ELEGANT
Hi Michael,
Thanks for your kind reply!
Actually I am a little bit confused about the XREFERENCE value in CSBEND. Because according to the source code of csbend.cpp, when we give a value of F1 and XREFERENCE for CSBEND, an additional value of F1/XREFERENCE will be added to b1. So I want to check that this XREFERENCE should be 1/K1 or 1/K1/rho0, in which rho0 is bending radius, Or neither but other values.
I am concerned about that because I want to add some errors for K1 and skew components in the CSBEND, but when I use the command of "error_element" for "F1 and "G1", I have get the file from the "file_log" and can see the error value i set for this CSBEND, but not the real value for b1(or K1) and a1(skew), I am a little bit confused about the transfer between the F1 and b1 (or G1 and a1), so how can I check that the error in this output file is the exact value that I want to set. Is there any script to do that?
For example, if I want to set the error with an amplitude of 2.5e3 for skew, which means i want to set the rms of a1(skew component) to be 2.5e3*b1, I can only error the "G1" by the "error_element" command, and I think if I just use amplitude of 2.5e3, with Gaussian, things may not run like what I supposed. Because I can't find what the exact value of a1.
sorry about that, and has things been described clearly?
Thanks again,
Zhilong
Thanks for your kind reply!
Actually I am a little bit confused about the XREFERENCE value in CSBEND. Because according to the source code of csbend.cpp, when we give a value of F1 and XREFERENCE for CSBEND, an additional value of F1/XREFERENCE will be added to b1. So I want to check that this XREFERENCE should be 1/K1 or 1/K1/rho0, in which rho0 is bending radius, Or neither but other values.
I am concerned about that because I want to add some errors for K1 and skew components in the CSBEND, but when I use the command of "error_element" for "F1 and "G1", I have get the file from the "file_log" and can see the error value i set for this CSBEND, but not the real value for b1(or K1) and a1(skew), I am a little bit confused about the transfer between the F1 and b1 (or G1 and a1), so how can I check that the error in this output file is the exact value that I want to set. Is there any script to do that?
For example, if I want to set the error with an amplitude of 2.5e3 for skew, which means i want to set the rms of a1(skew component) to be 2.5e3*b1, I can only error the "G1" by the "error_element" command, and I think if I just use amplitude of 2.5e3, with Gaussian, things may not run like what I supposed. Because I can't find what the exact value of a1.
sorry about that, and has things been described clearly?
Thanks again,
Zhilong

 Posts: 1797
 Joined: 19 May 2008, 09:33
 Location: Argonne National Laboratory
 Contact:
Re: Multiple error of dipole, Quadrupole, and sextupole in ELEGANT
Zhilong,
The Fn and Gn values are fractions of the main field at x=xReference. So xReference doesn't have any physical meaning, but is simply a reference location. E.g., for APSU we like to use xReference=10mm. As described in the manual page, there are three ways to specify the multipole content
1. Kn values, n=1, ..., 8. These are used if USE_BN=0. Units are 1/m^(n+1) The expansion for the field in the midplane is
By(x,y=0) = By(0,0) (1 + Sum{i=1,8} Kn*rho0*x^n/n!)
where rho0 is the central bending radius.
2. Bn values, n=1, ..., 8. These are used if USE_BN=1. Units are 1/m^n. Definition is Bn=Kn*rho0. The expansion in the midplane is
By(x,y=0) = By(0,0) (1 + Sum{i=1,8} Bn*x^n/n!)
where rho0 is the central bending radius.
3. Fn values, n=1, ..., 8. These are dimensionless and the effects are additive to the Bn or Kn values. Assuming USE_BN=0, the field expansion in the midplane is
By(x,y=0) = B(y,0) ( 1 + Sum{i=1,8}Kn*rho0*x^n/n! + Sum{i=1,8} Fn*(x/xReference)^n)
Hence, Fn is the fraction of the central field by which the total field is increased due to the nth component at x=xReference.
In terms of equivalent Kn and Bn values, we have Bn = n!Fn/xReference^n and Kn = rho0*n!*Fn/xReference^n.
The reason for these various ways of specifying the fields is user convenience. Using Kn is convenient in optics design, whereas using Fn and Gn is often convenient for communication with magnet designers.
I hope this clarifies things.
Michael
The Fn and Gn values are fractions of the main field at x=xReference. So xReference doesn't have any physical meaning, but is simply a reference location. E.g., for APSU we like to use xReference=10mm. As described in the manual page, there are three ways to specify the multipole content
1. Kn values, n=1, ..., 8. These are used if USE_BN=0. Units are 1/m^(n+1) The expansion for the field in the midplane is
By(x,y=0) = By(0,0) (1 + Sum{i=1,8} Kn*rho0*x^n/n!)
where rho0 is the central bending radius.
2. Bn values, n=1, ..., 8. These are used if USE_BN=1. Units are 1/m^n. Definition is Bn=Kn*rho0. The expansion in the midplane is
By(x,y=0) = By(0,0) (1 + Sum{i=1,8} Bn*x^n/n!)
where rho0 is the central bending radius.
3. Fn values, n=1, ..., 8. These are dimensionless and the effects are additive to the Bn or Kn values. Assuming USE_BN=0, the field expansion in the midplane is
By(x,y=0) = B(y,0) ( 1 + Sum{i=1,8}Kn*rho0*x^n/n! + Sum{i=1,8} Fn*(x/xReference)^n)
Hence, Fn is the fraction of the central field by which the total field is increased due to the nth component at x=xReference.
In terms of equivalent Kn and Bn values, we have Bn = n!Fn/xReference^n and Kn = rho0*n!*Fn/xReference^n.
The reason for these various ways of specifying the fields is user convenience. Using Kn is convenient in optics design, whereas using Fn and Gn is often convenient for communication with magnet designers.
I hope this clarifies things.
Michael
Re: Multiple error of dipole, Quadrupole, and sextupole in ELEGANT
Hi Michael,
Thanks! With you help, I think I understand the definition now!
Regards,
Zhilong
Thanks! With you help, I think I understand the definition now!
Regards,
Zhilong