Page 1 of 2

Tune difference between MADX and ELEGANT when we have decouping section?

Posted: 14 Mar 2018, 16:00
by gwei
Hi Micheal,

I find a tune difference in a collider ring lattice between MADX and ELEGANT.
The collider ring has two decoupling section. This cause a different tune output from the two CODE.
It is right?

Thank you.

Guohui

Re: Tune difference between MADX and ELEGANT when we have decouping section?

Posted: 14 Mar 2018, 16:25
by michael_borland
Guohui,

I would need to see the lattice file to comment. Can you upload it?

--Michael

Re: Tune difference between MADX and ELEGANT when we have decouping section?

Posted: 15 Mar 2018, 09:00
by gwei
Michael,

I have email them to you.
Thank you.

Guohui
michael_borland wrote:
14 Mar 2018, 16:25
Guohui,

I would need to see the lattice file to comment. Can you upload it?

--Michael

Re: Tune difference between MADX and ELEGANT when we have decouping section?

Posted: 15 Mar 2018, 09:34
by michael_borland
Guohui,

The problem is that your lattice has x-y coupling, which twiss_output does not handle correctly. You can check the tunes by tracking, using the attached file. The result is postprocessed with sddsnaff, e.g.,

Code: Select all

sddsnaff model.w1 -col=Pass -pair=Cx,Cxp -pair=Cy,Cyp -pipe=out -term=freq=1 | sddsprintout -pipe -col=*Freq*
Printout for SDDS file stdin

  CxFrequency    CyFrequency  
------------------------------
  2.196534e-01   1.601147e-01 
These results are much closer to those given by MADX.

There is a coupled_twiss_output command available, but it doesn't give the tunes and I couldn't get it to work for your lattice. We'll look at this further, since it should work.

--Michael

Re: Tune difference between MADX and ELEGANT when we have decouping section?

Posted: 15 Mar 2018, 13:19
by gwei
Hi Michael,

Thank you very much.
By the way, how did you calculate tune in $twiss_output? And are beta_x, alfa_x right in the output of $twiss_output?
Or in the output of $twiss_outputare, are beta_x, alfa_x right in decoupling section in the lattice, but wrong in the coupling section?
As you know, MADX usually use Beta11, Beta22, Beta12, and Beta21 in coupling section.
If we use a $twiss_outputare on a lattice with coupling section, is all the beta_x beta11? is all the beta_y beta22?
Best wishes

Guohui
michael_borland wrote:
15 Mar 2018, 09:34
Guohui,

The problem is that your lattice has x-y coupling, which twiss_output does not handle correctly. You can check the tunes by tracking, using the attached file. The result is postprocessed with sddsnaff, e.g.,

Code: Select all

sddsnaff model.w1 -col=Pass -pair=Cx,Cxp -pair=Cy,Cyp -pipe=out -term=freq=1 | sddsprintout -pipe -col=*Freq*
Printout for SDDS file stdin

  CxFrequency    CyFrequency  
------------------------------
  2.196534e-01   1.601147e-01 
These results are much closer to those given by MADX.

There is a coupled_twiss_output command available, but it doesn't give the tunes and I couldn't get it to work for your lattice. We'll look at this further, since it should work.

--Michael

Re: Tune difference between MADX and ELEGANT when we have decouping section?

Posted: 15 Mar 2018, 13:27
by michael_borland
Guohui,

&twiss_output assumes that the lattice is uncoupled. The beta functions etc. are computed from the 2x2 submatrices for the x and y planes. So stritly speaking they are not correct anywhere in the presence of coupling.

You can compute the coupled twiss parameters for the four modes using the following command

Code: Select all

&coupled_twiss_output
    filename = %s.ctwi,
    emittance_ratio = 1e-02,
    emit_x = 1e-10,
    sigma_dp = 1e-10,
    calculate_3d_coupling = 1,
    concat_order = 2,
&end
If you compare betax1 from this command from betax from &twiss_output, you'll see differences throughout the lattice.

Unfortunately, &coupled_twiss_output doesn't provide the tunes, but we will add that in the next release.

--Michael

Re: Tune difference between MADX and ELEGANT when we have decouping section?

Posted: 15 Mar 2018, 15:34
by gwei
Thank you very much, Michael.
michael_borland wrote:
15 Mar 2018, 13:27
Guohui,

&twiss_output assumes that the lattice is uncoupled. The beta functions etc. are computed from the 2x2 submatrices for the x and y planes. So stritly speaking they are not correct anywhere in the presence of coupling.

You can compute the coupled twiss parameters for the four modes using the following command

Code: Select all

&coupled_twiss_output
    filename = %s.ctwi,
    emittance_ratio = 1e-02,
    emit_x = 1e-10,
    sigma_dp = 1e-10,
    calculate_3d_coupling = 1,
    concat_order = 2,
&end
If you compare betax1 from this command from betax from &twiss_output, you'll see differences throughout the lattice.

Unfortunately, &coupled_twiss_output doesn't provide the tunes, but we will add that in the next release.

--Michael

Re: Tune difference between MADX and ELEGANT when we have decouping section?

Posted: 15 Mar 2018, 15:46
by gwei
Hi Michael,

I add the your suggested lines of &coupled_twiss_output to the .ele file as attached.
But when I run it, it gives a
emittances_from_twiss_command was set but twiss calculations not seen

Thanks.

Guohui
michael_borland wrote:
15 Mar 2018, 13:27
Guohui,

&twiss_output assumes that the lattice is uncoupled. The beta functions etc. are computed from the 2x2 submatrices for the x and y planes. So stritly speaking they are not correct anywhere in the presence of coupling.

You can compute the coupled twiss parameters for the four modes using the following command

Code: Select all

&coupled_twiss_output
    filename = %s.ctwi,
    emittance_ratio = 1e-02,
    emit_x = 1e-10,
    sigma_dp = 1e-10,
    calculate_3d_coupling = 1,
    concat_order = 2,
&end
If you compare betax1 from this command from betax from &twiss_output, you'll see differences throughout the lattice.

Unfortunately, &coupled_twiss_output doesn't provide the tunes, but we will add that in the next release.

--Michael

Re: Tune difference between MADX and ELEGANT when we have decouping section?

Posted: 15 Mar 2018, 15:47
by gwei
gwei wrote:
15 Mar 2018, 15:46
Hi Michael,

I add the your suggested lines of &coupled_twiss_output to the .ele file as attached.
But when I run it, it gives a error information as follow.
emittances_from_twiss_command was set but twiss calculations not seen

Thanks.

Guohui
michael_borland wrote:
15 Mar 2018, 13:27
Guohui,

&twiss_output assumes that the lattice is uncoupled. The beta functions etc. are computed from the 2x2 submatrices for the x and y planes. So stritly speaking they are not correct anywhere in the presence of coupling.

You can compute the coupled twiss parameters for the four modes using the following command

Code: Select all

&coupled_twiss_output
    filename = %s.ctwi,
    emittance_ratio = 1e-02,
    emit_x = 1e-10,
    sigma_dp = 1e-10,
    calculate_3d_coupling = 1,
    concat_order = 2,
&end
If you compare betax1 from this command from betax from &twiss_output, you'll see differences throughout the lattice.

Unfortunately, &coupled_twiss_output doesn't provide the tunes, but we will add that in the next release.

--Michael

Re: Tune difference between MADX and ELEGANT when we have decouping section?

Posted: 15 Mar 2018, 15:49
by michael_borland
Guohui,

Sorry, my mistake. Add

Code: Select all

emittances_from_twiss_command = 0
to the &coupled_twiss_output command.

--Michael