Skip to content

Exercise Optics matching

ChristopherMayes edited this page Sep 6, 2017 · 2 revisions

This exercise will teach you to match Twiss parameters at the end of a section. It is very similar to the files in tao/examples/optics_matching/ in the Bmad distribution.

Let's start with a 10 MeV beam:

parameter[lattice] = "Tao optics matching example"
beginning[beta_a] = 5
beginning[beta_b] = 5

parameter[geometry] = open
parameter[e_tot] = 10e6

and write tao.init and lattice files to do the following.

To make the plots look as below, use this file: tao_plot.init

and initialize tao as:

tao -plot tao_plot.init

  1. Make a 5 m long section, and place 10 cm long quads similar to

  1. Make tao variables to control K1 for all of these quads. Have these variables bound to the keyboard. Use the keys to manipulate the quad strengths, so that the beta function plot looks something like:


  1. Optimize these quads to satisfy the following conditions at the end of your lattice:

    beta.a = 12.5, alpha.a = -1, beta.b = 12.5, alpha.b = -1, eta.x = 0, etap.x = 0

Try doing this with two different optimizers:

set global optimizer = lmdif

or

set global optimizer = de

To easily reset the lattice:

set lattice model = design

  1. Add bends to the layout in the form of a chicane as follows. The bends should be 20 cm long, and the chicane should bend the beam by 10 degrees. The pipes between the bends should each be 1 m long.

Now repeat the optimization from step 3). Once you have a nice solution, you can get the values in a Bmad lattice format with:

show var -bmad -good

This will print to the screen, as in :

Tao> show var -bmad -good
Q1[K1] =   0.00000000000000E+00
Q2[K1] =   0.00000000000000E+00
Q3[K1] =   0.00000000000000E+00
Q4[K1] =   0.00000000000000E+00
Q5[K1] =   0.00000000000000E+00
Q6[K1] =   0.00000000000000E+00

To save directly to a file, add the write option:

show -write solution.bmad var -bmad -good

  1. Add an overlay to the bends to simultaneously control all of their bending and edge angles with one number. Add a Tao variable to control the angle of this overlay using the the keys.