Skip to content

Data and Variables in Tao

ChristopherMayes edited this page Sep 5, 2017 · 9 revisions

Data

In order to optimize, you must tell Tao what quantities that you want to calculate that will contribute to the merit function. The basic structure has several: d2_data, which contains d1_data, which contains individual datums. You input these in the tao.init file as:

&tao_d2_data
    d2_data%name = 'twiss'
    n_d1_data = 2
/
&tao_d1_data
    ix_d1_data = 1
    d1_data%name = 'end'
    datum( 1) =  'beta.a'     '' '' 'END'   'target'  12.5   1e1  
    datum( 2) =  'alpha.a'    '' '' 'END'   'target'  -1     1e2
/ 
&tao_d1_data
    ix_d1_data = 2
    d1_data%name = 'max'
    datum( 1) =  'beta.a'    '' 'Q1' 'END'   'max'  100   1e1
    datum( 2) =  'eta.x'     '' 'Q1' 'END'   'abs_max'  1     1e2
/ 

The first datum means that beta.a at element END should be 12.5 m with a weight of 10. If the model beta function is, say, 20 m at element END, then this datum would contribute 10*(20 - 12.5)^2 to the merit function.


Variables

Variables must be defined in order to optimize. The simplest possible variable definition is:

&tao_var
  v1_var%name = 'quad'
  default_step = 1e-4
  default_attribute = 'k1'
  search_for_lat_eles = 'Quad::*'
  ! or: 
  ! var(1:)%ele_name = 'Q1', 'Q2', 'Q3', 'Q4', 'Q5', 'Q6'
/

In tao you will then see (if the elements exist) the variables in a short notation:

Tao> sho var
       Name                                      Using for Optimization
    quad[1:6]

or a more detailed list:

Tao> sho var quad
Variable name:  quad

 Index  Controlled Attributes(s)    Meas         Model        Design  Useit_opt
     1  Q1[K1]                  8.6924-311    0.0000E+00    0.0000E+00       F
     2  Q2[K1]                  8.6924-311    0.0000E+00    0.0000E+00       F
     3  Q3[K1]                  8.6924-311    0.0000E+00    0.0000E+00       F
     4  Q4[K1]                  8.6924-311    0.0000E+00    0.0000E+00       F
     5  Q5[K1]                  8.6924-311    0.0000E+00    0.0000E+00       F
     6  Q6[K1]                  8.6924-311    0.0000E+00    0.0000E+00       F
 Index  Controlled Attributes(s)    Meas         Model        Design  Useit_opt

A tao_var is thus an array of variables, each of which can have individually set attributes. Type:

Tao> sho var quad[2]
%ele_name         = Q2
%attrib_name      = K1
...

to see a complete list