Changeset 11 in TRACY3 for trunk/tracy/tracy/doc
- Timestamp:
- Oct 21, 2013, 10:40:43 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tracy/tracy/doc/soltracy3_userManual_developer.tex
r10 r11 8 8 \usepackage[colorlinks=true,urlcolor=magenta,citecolor=blue]{hyperref} 9 9 \usepackage{color} 10 \usepackage{setspace} 11 12 13 %% auto center the sentence in the line 14 \newenvironment{tightcenter}{% 15 \vspace{0.02in} 16 \setlength\topsep{0pt} 17 \setlength\parskip{0pt} 18 \begin{center} 19 }{% 20 \end{center} 21 \vspace{0.02in} 22 } 23 24 %% auto wrap a long word 25 \newcommand*\wrapletters[1]{\wr@pletters#1\@nil} 26 \def\wr@pletters#1#2\@nil{#1\allowbreak\if&\else\wr@pletters#2\@nil\fi} 27 28 % define the file path font 29 \newcommand{\pathfont}[1]{\textit{\wrapletters{#1}}} 30 % define the font and color of the Tracy command in Tracy file 31 \newcommand{\tracycommand}[2]{\begin{tightcenter} 32 \textsf{\textcolor{red}{#1}} \quad \textsf{\textcolor{blue}{#2}} 33 \end{tightcenter}} 34 \newcommand{\tracycomm}[1]{\textsf{\textcolor{red}{#1}}} 35 \newcommand{\tracypara}[1]{\textsf{\textcolor{blue}{#1}}} 36 37 % lattice element definition 38 \newcommand{\latticedef}[3]{\begin{tightcenter} 39 \textsf{\textcolor{black}{#1}} 40 \textsf{\textcolor{red}{#2}} \quad \textsf{\textcolor{blue}{#3}} 41 \end{tightcenter}} 42 \newcommand{\elemname}[1]{\textsf{\textcolor{black}{#1}}} 43 \newcommand{\elemkeyword}[1]{\textsf{\textcolor{red}{#1}}} 44 \newcommand{\elempara}[1]{\textsf{\textcolor{blue}{#1}}} 45 46 \newcommand{\notespace}[1]{\vspace{0.1in}\textbf{#1} \vspace{0.05in}} 47 10 48 11 49 \begin{document} … … 14 52 \tableofcontents 15 53 54 %\onehalfspacing 55 16 56 \section{Log} 17 57 18 58 \begin{itemize} 19 \item[05/10/2012] Add the control flag to control the entrance and exit edge effects and fringe field of the dipole, with``edge\_effect1 = 1'' in the dipole definition in the lattice file, the 59 \item[05/10/2012] Add the control flag to control the entrance and exit edge effects and fringe 60 field of the dipole, with``edge\_effect1 = 1'' in the dipole definition in the lattice file, the 20 61 entrance edge effect and fringe field of the dipole are turned on, with ``edge\_effect1 = 0'', 21 62 this effects are turned off. These two effects at the exit of the dipole are controlled by … … 24 65 25 66 \section{Introduction} 26 Tracy is a code to do long term tracking, and is written in the mixture of c and c++. This code is kept on developing. Soleil version of Tracy 3 is a code with more flexibility and easy to use. User does not need to know the structure of the code, what they need to do is to write an input script, and then run the code. 67 Tracy is a code to do long term tracking, and is written in the mixture of c and c++. 68 This code is kept on developing. Soleil version of Tracy 3 is a code with more flexibility and easy to use. User does not need to know the structure of the code, what they need to do is to write an input script, and then run the code. 27 69 Based on the need, user can write the files to define multipole field errors, misalignment errors of the lattice elements, and vacuum chamber, and then provide the file name in the user input script, in order to set the field errors of the lattice elements and the vacuum limit for the different region of the lattice. 28 70 Attention: … … 30 72 Although the user can define the file name whatever they want, it is suggested to name the file which is used to define multipole field error with the extension â.feâ and name the file which is used to define the misalignment error with the extension â.aeâ. 31 73 32 There are two versions of Tracy 3, non-parallel version and parallel version. Non-parallel version Tracy is for the single computer, parallel version of Tracy is for the the cluster. The user defined input script â*.prmâ can be used for both parallel and non-parallel version Tracy. 74 There are two versions of Tracy 3, non-parallel version and parallel version. Non-parallel version Tracy is for the single computer, parallel version of Tracy is for the the cluster. The user defined input script which can be used for both parallel and non-parallel version Tracy. The ascii file with any extension isacceptable for Tracy3, but the extension is suggested to be â.prmâ. 75 33 76 \section{ Non-parallel version Tracy} 34 77 \subsection {Compile} 35 The make file of Tracy is generated by âautomakeâ. Based on the compilers used, user needs to update âmake\_for\_gcc.shâ under path ``\$HOME/TracyIII/'' or the ``Makefile.am'' under path ``\$HOME/TracyIII/tracy/tracy/src'' and ``\$HOME/TracyIII/tracy/tools''. The compilers used on the server ``metis'' of SOLEIL Synchrotron are ``gfortran'', and ``gcc''. 36 37 To compile the code, run 38 39 make\_for\_gcc.sh opt 40 41 under the shell terminal, an executive file ``soltracy'' is automatically generated under path ``\$HOME/TracyIII/tracy/tools''. 78 The make file of Tracy is generated by âautomakeâ. Based on the compilers used, 79 user needs to update â\textsf{\wrapletters{make\_for\_gcc.sh}}â under 80 path ``\pathfont{\$HOME/TracyIII/}'' 81 or the ``Makefile.am'' under path ``\pathfont{\$HOME/TracyIII/tracy/tracy/src}'' 82 and ``\pathfont{\$HOME/TracyIII/tracy/tools}''. The compilers used on the server 83 ``metis'' of SOLEIL Synchrotron are ``gfortran'', and ``gcc''. 84 85 To compile the code, run the command under the shell terminal: 86 \begin{tightcenter} 87 \textsf{make\_for\_gcc.sh} \qquad \textsf{opt} 88 \end{tightcenter} 89 Then the executive file ``soltracy'' is automatically 90 generated under path ``\pathfont{\$HOME/TracyIII/tracy/tools}''. 42 91 43 92 \subsection{Run} 44 45 To execute Tracy, user needs to provide an input script with the file extension â.prmâ. For example, ``Input\_test.prm'' is a user defined script, user can type the command line 46 47 soltracy Input\_test.prm 48 49 under the shell terminal, and then press ``return'' key to execute the code. The input script file name can be defined with any valid string except it must be ended with the file extension ``.prm''. 93 To execute Tracy, the user needs to define an input file with the 94 the lattice file names and the related commands (section~\ref{}). 95 The name of the input file can be any valid characters. Although 96 there is no limitation to the extension of the file, the extension 97 ``.prm'' is preferred. For example, To run the user defined input file 98 ``Input\_test.prm'', user can type the command: 99 \begin{tightcenter} 100 \textsf{soltracy} \qquad \textsf{Input\_test.prm} 101 \end{tightcenter} 50 102 51 103 \section{ Parallel version Tracy} … … 63 115 64 116 \subsection{Compile} 65 The commonly used compilers for parallel computation are MPI 2, and Intel MPI which is based on MPI 2. For the cluster of SOLEIL Synchrotron, Intel MPI is installed. To get the parallel Tracy work, three files of the non-parallel version Tracy need to be modified. 66 The details are shown in the following steps. 117 The commonly used compilers for parallel computation are MPI 2, and Intel 118 MPI which is based on MPI 2. For the cluster of SOLEIL Synchrotron, Intel 119 MPI is installed. To get the parallel Tracy work, three files of the 120 non-parallel version Tracy need to be modified. The details are shown in 121 the following steps. 67 122 \begin{enumerate} 68 123 \item 69 124 The path of included files of Intel MPI is added in ``Makefile.am'' under 70 path ``\$HOME/TracyIII/tracy/tracy/src'' (shown in BLUE color): 71 72 INCLUDES = -I../inc -I\$(NUM\_REC)/inc 73 -I/opt/intel/impi/3.2.2.006/include64 125 path ``\pathfont{\$HOME/TracyIII/tracy/tracy/src}'' (shown in BLUE color): 126 127 \wrapletters{INCLUDES = -I../inc -I\$(NUM\_REC)/inc \quad 128 -I/opt/intel/impi/3.2.2.006/include64} 129 74 130 \item 75 131 The execute file, source file, paths of included files and library of Intel 76 MPI are modified in ``Makefile.am'' under path ``\ $HOME/TracyIII/tracy/tools''132 MPI are modified in ``Makefile.am'' under path ``\pathfont{\$HOME/TracyIII/tracy/tools}'' 77 133 (shown in BLUE color): 78 134 79 135 bin\_PROGRAMS = psoltracy 80 136 81 soltracy\_SOURCES = soltracy.cc nrutil.c nrcheck.c 82 nrlinwww.c nrframe.c ../tracy/src/tracy\_lib.cc -> 83 psoltracy\_SOURCES = psoltracy.cc nrutil.c nrcheck.c 84 nrlinwww.c nrframe.c ../tracy/src/tracy\_lib.cc 85 86 LIBS = -L\$(NUM\_REC)/lib 87 -L/opt/intel/impi/3.2.2.006/lib64 -L\$(LIBPATH) 88 -lrecipes\_c\_icc -lstdc++ -lgfortran -lmpichcxx 137 soltracy\_SOURCES = \texttt{soltracy.cc nrutil.c nrcheck.c } 138 \texttt{ nrlinwww.c nrframe.c ../tracy/src/tracy\_lib.cc $\rightarrow$} 139 140 psoltracy\_SOURCES = \texttt{psoltracy.cc nrutil.c nrcheck.c 141 nrlinwww.c nrframe.c ../tracy/src/tracy\_lib.cc} 142 143 LIBS = \texttt{\wrapletters{-L\$(NUM\_REC)/lib \quad 144 -L/opt/intel/impi/3.2.2.006/lib64 \quad -L\$(LIBPATH) \quad 145 -lrecipes\_c\_icc \quad -lstdc++ \quad -lgfortran \quad -lmpichcxx}} 89 146 90 INCLUDES = -I\$(TRACY\_LIB)/tracy/inc -I\$(NUM\_REC)/inc 91 -I/opt/intel/impi/3.2.2.006/include64 147 INCLUDES = \texttt{\wrapletters{-I\$(TRACY\_LIB)/tracy/inc \quad -I\$(NUM\_REC)/inc 148 \quad -I/opt/intel/impi/3.2.2.006/include64}} 149 92 150 \item 93 The compilers used in the parallel computing are defined in the ``make\_for\_psoltracy.sh'' located in path ``\$HOME/TracyIII'' as (shown in BLUE color): 94 95 CC = mpiicc 96 97 CXX = mpiicpc 98 99 F77 = mpiifort 151 The compilers used in the parallel computing are defined in the 152 ``\wrapletters{make\_for\_psoltracy.sh}'' located in path ``\$HOME/TracyIII'' 153 as (shown in BLUE color): 154 155 CC = \texttt{mpiicc} 156 157 CXX = \texttt{mpiicpc} 158 159 F77 = \texttt{mpiifort} 100 160 101 161 Depending on the compilers used to do parallel computation, user needs to … … 103 163 files and library which are shown above with blue color. 104 164 105 165 After updating compilers, paths of included files and library for parallel 106 166 computation, user can run 107 108 make\_for\_psoltracy.sh 109 167 \begin{tightcenter} 168 \textsf{make\_for\_psoltracy.sh} 169 \end{tightcenter} 110 170 under the shell script to compile the parallel Tracy. After compilation, 111 171 the execute file ``psoltracy'' is automatically generated under the 112 path ``\$HOME/TracyIII/tracy/tools''. 113 114 172 path ``\pathfont{\$HOME/TracyIII/tracy/tools}''. 115 173 \end{enumerate} 116 174 175 117 176 \subsection{Run} 118 As the non-parallel version Tracy, user needs to write the commands in a script which must be with the file extension â.prmâ. The syntaxes to define the script â*.prmâ are the same for both non-parallel and parallel Tracy. 119 To run the parallel Tracy, user need to contact the administrator of their cluster to know how to run parallel programs on the cluster. For the cluster on Synchrotron SOLEIL, the nodes used to do parallel computation are assigned by PBS (Portable Batch System), so a script is need. For example, user define the input script âtest.prmâ to tell Tracy what jobs are need to be done on the cluster, define script âlance\_tracy3\_parallel.shâ to assign the numbers of CPUs to do parallel computation and lance job to the SOLEIL cluster. and then type the following command under the bash shell to submit the job and run the parallel Tracy on the cluster: 120 121 lance\_tracy3\_parallel.sh test.prm 177 As the non-parallel version Tracy, user needs to write the commands in a 178 script which must be with the file extension ``.prm''. The syntaxes to define 179 the script ``*.prm'' are the same for both non-parallel and parallel 180 Tracy. 181 182 To run the parallel Tracy, user need to contact the administrator of their 183 cluster to know how to run parallel programs on the cluster. For the cluster 184 on Synchrotron SOLEIL, the nodes used to do parallel computation are assigned 185 by PBS (Portable Batch System), so a script is need. For example, user define 186 the input script \texttt{test.prm} to tell Tracy what jobs are need to be done on the 187 cluster, define script \textsf{\wrapletters{lance\_tracy3\_parallel.sh}} to assign 188 the numbers of CPUs to do 189 parallel computation and lance job to the SOLEIL cluster; and then type the 190 following command under the bash shell to submit the job and run the parallel 191 Tracy on the cluster: 192 \begin{tightcenter} 193 \textsf{lance\_tracy3\_parallel.sh \qquad test.prm} 194 \end{tightcenter} 195 122 196 123 197 \section{ User input script} 124 There are two types of keywords in the user input script. The first type is to set the file, the file names, and define parameters for the related calculations; the key words for such definitions are ended with the characters âFlagâ. The second type is to define Boolean commands with or without parameters to do different calculations. The rules of the definition of input scripts are: 125 The blank lines and lines starting with "\#" (comment line) are ignored by the code. 126 Keywords without âFlagâ as the final 4 characters are NOT executed according to the defined sequence in user input script. If the same command keywords are defined many times in the user script, only the last defined keyword is executed. 127 The commands with the last 4 characters as âFlagâ are executed according to the sequence in the code. 128 The definition of lattice file at the beginning of the user script is mandatory. If the lattice file is with any of the following elements: horizontal correctors, vertical correctors, girders, BPM, skew quadrupoles, user must declare the element name at the beginning of input script. 129 One keyword command uses one line. User can not define more than one command at the same line. 130 Except explanation, all commands with Boolean flag are the generic commands, and can be used on all the lattice of the ring. 131 \subsection{ File path} 132 In the user input script, user can specify the name of the files which are used in the calculation, such as the lattice file, multipole field error file, misalignment error file, vacuum chamber file. When specifying the file name, user can provide the absolute path for the file which is not located at the current path, such as: â/home/physmach/Tracy3/tracy/soleil.latâ; or for convenience, user provides the filename without absolute path, but put the files at a certain directory and then specific this directory using the command: 133 in\_dir user\_defined\_path 134 For example: 135 in\_dir /home/zhang/codes/TracyIII/lattice/ 136 137 This command tells the code all the files specified in the script are located at the directory â/home/zhang/codes/TracyIII/lattice/â. If user declares the files without absolute path and does not set the directory through command in\_dir; or the files specified in the script are not found at the current working path, the code will give an error message and stop running. 138 139 \section{ File names} 198 There are two types of keywords in the user input script. The first type is 199 to set the file, the file names, and define parameters for the related 200 calculations; the key words for such definitions are ended with the 201 characters ``Flag''. The second type is to define Boolean commands with or 202 without parameters to do different calculations. The rules of the definition 203 of input scripts are: 204 \begin{itemize} 205 \item 206 The blank lines and lines starting with ``\#'' (comment line) are ignored 207 by the code. 208 \item 209 Keywords without ``Flag'' as the final 4 characters are NOT executed according 210 to the defined sequence in user input script. If the same command keywords 211 are defined many times in the user script, only the last defined keyword is 212 executed. 213 \item 214 The commands with the last 4 characters as ``Flag'' are executed according 215 to the sequence in the code. 216 \item 217 The definition of lattice file at the beginning of the user script is mandatory. 218 \item 219 If the horizontal correctors, or vertical correctors, or girders, Beam Position 220 Monitors, or skew quadrupoles are defined in the lattice file, user must 221 declare the element name at the beginning of Tracy input file. 222 \item 223 One keyword command uses one line. User can not define more than one command 224 at the same line. 225 \item 226 Except explanation, all commands with Boolean flag are the generic commands, 227 that is, the commands are not machine dependent. 228 \end{itemize} 229 230 \subsection{File path} 231 In the user input script, user can specify the name of the files which are used 232 in the calculation, such as the lattice file, multipole field error file, 233 misalignment error file, vacuum chamber file. When specifying the file name without 234 file path in the Tracy input file, Tracy will look for the file in the current 235 work path. Otherwise, user need to provide the absolute path of the file which is 236 not located at the current path, such as: ``\texttt{\wrapletters{/home/physmach/Tracy3/tracy/soleil.lat}}''. 237 Another method is to provide the filename without absolute path, but put all the 238 called external files at a certain directory, and this directory is defined in the 239 Tracy input file using the command: 240 \tracycommand{in\_dir}{user\_defined\_path} 241 For example, 242 \tracycommand{in\_dir}{/home/zhang/codes/TracyIII/lattice/} 243 This example tells the code all the files defined with absolute file path in the Tracy 244 input file are located 245 at the directory \pathfont{/home/zhang/codes/TracyIII/lattice/}. If user declares the files 246 without absolute path and does not set the directory through command \textsf{in\_dir}; or 247 the files specified in the script are not found at the current working path, 248 the code will give an error message and stop running. 249 250 \section{File names} 140 251 141 252 \subsection{Lattice file name} 142 In the input script, user must define the lattice name, this is mandatory. The command is: 143 lat\_file lattice\_file\_name 144 Here âlattice\_file\_nameâ is the lattice file name without â.latâ extension. For example, the following command sets the lattice file of SOLEIL ring: 145 lat\_file solamor2\_reglage\_focalisation\_chcvqt\_thicksextu\_LQPintermediaire\_QFF 146 In Tracy 3, after reading the lattice, Twiss parameters are automatically printed to the file âlinlat.outâ. 147 If one of these elements (Horizontal/vertical correctors or beam position monitors, or girders, or skew quadrupoles.) are defined in the lattice file, for example to read the misalignment errors of the lattice element and then do orbit correction, to read multipole field errors (SOLEIL lattice), etc.; user MUST specify the names of these elements using the corresponding commands in the â*.prmâ script: 148 h\_corr HCM 149 v\_corr VCM 150 gs GS 151 ge GE 152 bpm\_name BPM 153 qt QT 154 Here âHCMâ is the name of horizontal correctors used for horizontal orbit correction, or the horizontal correctors on which the multipole field errors are added in SOLEIL lattice; âVCMâ is the name of vertical correctors used for vertical orbit correction, or the vertical correctors on which the multipole field errors are added in SOLEIL lattice; âGSâ is the name of the start girder; âGEâ is the name of the end girder; âBPMâ is the name of beam position monitors defined in the lattice file; âQTâ is the name of the skew quadrupoles defined in the lattice. Generally, user needs to define horizontal, vertical correctors and BPMs when reading the misalignment errors or correcting closed orbit distortion 253 In the input script, user must define the lattice name, this is mandatory. 254 The command is: 255 256 \tracycommand{lat\_file}{lattice\_file\_name} 257 258 Here \tracypara{lattice\_file\_name} is the lattice file name without the extension ``.lat''. 259 For example, the following command sets the lattice file of SOLEIL ring: 260 \tracycommand{lat\_file}{solamor2} 261 262 n Tracy 3, after reading the lattice, Twiss parameters are automatically printed to the 263 file \textsl{linlat.out}. 264 265 If one of these elements (Horizontal/vertical correctors or beam position monitors, or 266 girders, or skew quadrupoles.) are defined in the lattice file, for example to read 267 the misalignment errors of the lattice element and then do orbit correction, to read multipole 268 field errors (SOLEIL lattice), etc.; user MUST specify the names of these elements using the 269 corresponding commands in the Tracy input file: 270 \tracycommand{h\_corr}{HCM} 271 \tracycommand{v\_corr}{VCM} 272 \tracycommand{gs}{GS} 273 \tracycommand{ge}{GE} 274 \tracycommand{bpm\_name}{BPM} 275 \tracycommand{qt}{QT} 276 Here \tracypara{HCM} is the name of horizontal correctors for horizontal orbit correction, 277 or the horizontal correctors on which the multipole field errors are added in SOLEIL lattice; 278 \tracypara{VCM} is the name of vertical correctors used for vertical orbit correction, or 279 the vertical correctors on which the multipole field errors are added in SOLEIL lattice; 280 \tracypara{GS} is the name of the start girder; \tracypara{GE} is the name of the end girder; 281 \tracypara{BPM} is the name of beam position monitors defined in the lattice file; 282 \tracypara{QT} is the name of the skew quadrupoles defined in the lattice. Generally, 283 user needs to define horizontal, vertical correctors and BPMs when reading the misalignment 284 errors or correcting closed orbit distortion. 155 285 156 286 \subsection{Multipole field error file name (SOLEIL lattice)} 157 User can read the multipole field errors on SOLEIL lattice from an external file; the file is specified in the user script using the following command: 158 multipole\_file multipole\_file\_name 159 Here âmultipole\_file\_nameâ is the user defined multipole field error file, the format of this file is given in section Error: Reference source not found. 160 161 If the multipole field errors of horizontal, vertical correctors and skew quadrupoles are defined in the âmultipole\_fileâ, user MUST specify the names of these lattice elements in the â*.prmâ file as the following example: 162 h\_corr CH 163 v\_corr CV 164 qt QT 165 Here âCHâ, âCVâ and âQTâ are the names of horizontal, vertical correctors, and skew quadrupoles respectively which are defined in the lattice file. 287 User can read the multipole field errors on SOLEIL lattice from an external file; 288 the file is specified in the user script using the following command: 289 \tracycommand{multipole\_file}{multipole\_file\_name} 290 Here \tracypara{multipole\_file\_name} is the user defined multipole field error file, 291 the format of this file is given in section~\ref{}. 292 293 If the multipole field errors of horizontal, vertical correctors and skew quadrupoles 294 are defined in the \tracypara{multipole\_file}, user MUST specify the names of these 295 lattice elements in the Tracy input file as the following example: 296 \tracycommand{h\_corr}{CH} 297 \tracycommand{v\_corr}{CV} 298 \tracycommand{qt}{QT} 299 Here \tracypara{CH}, \tracypara{CV} and \tracypara{QT} are the names of horizontal, 300 vertical correctors, and skew quadrupoles respectively which are defined in the lattice file. 166 301 167 302 \subsection{Files of multipole field errors of correctors and skew quadrupoles (SOLEIL lattice)} 168 Horizontal, vertical correctors and skew quadrupoles are integrated with the sextupole quadrupoles on SOLEIL storage ring. To define the multipole field errors on these elements, user need to define the orders and relative strengths of multipole field errors in the multipole field error file (section Error: Reference source not found) and specify the file name in the user input script â*.prmâ (section Multipole field error file name), then specify the file names as the following example: 169 fic\_hcorr corh.txt 170 fic\_vcorr corv.txt 171 fic\_skew corqt.txt 172 Here âcorh.txtâ and âcorv.txtâ are the files with measured current values corh, corv, corqt (with unit [Ampere]) for the horizontal, vertical correctors and skew quadrupoles respectively. Based on the measured current values, user can get the integrated field strength as: 173 Hcorr\_strength [T.m] = corh *\_convHcorr /brho; (horizontal correctors) 174 Vcorr\_strength [T.m] = corv *\_convVcorr /brho; (vertical correctors) 175 Qt\_strength [T.m] = corqt *\_convQt /brho; (skew quadrupoles) 176 here brho is the momentum rigidity, and the conversion constants between current and field are \_convHcorr = 8.14e-4, \_convVcorr = 4.642e-4, \_convQt = 93.83e-4. 177 For SOLEIL lattice, the SAME ORDER of multipole field errors on the same elements are added together, so the SAME ORDER of horizontal/vertical, skew quadrupoles, and sextupoles are added together since these elements are integrated at the same magnets. 303 Horizontal, vertical correctors and skew quadrupoles are integrated with the sextupole quadrupoles 304 on SOLEIL storage ring. To define the multipole field errors on these elements, user need to define the orders and relative strengths of multipole field errors in the multipole field error file (section Error: Reference source not found) and specify the file name in the user input script â*.prmâ (section Multipole field error file name), then specify the file names as the following example: 305 \tracycommand{fic\_hcorr}{corh.txt} 306 \tracycommand{fic\_vcorr}{corv.txt} 307 \tracycommand{fic\_skew}{corqt.txt} 308 Here \tracypara{corh.txt} and \tracypara{corv.txt} are the files with measured current values corh, 309 corv, corqt (with unit [Ampere]) for the horizontal, vertical correctors and skew quadrupoles 310 respectively. Based on the measured current values, user can get the integrated field strength as:\\ 311 \vspace{0.02in} 312 \texttt{Hcorr\_strength [T.m] = corh *\_convHcorr /brho; (horizontal correctors) \\} 313 \vspace{0.02in} 314 \texttt{Vcorr\_strength [T.m] = corv *\_convVcorr /brho; (vertical correctors)} \\ 315 \vspace{0.02in} 316 \texttt{Qt\_strength [T.m] = corqt *\_convQt /brho; (skew quadrupoles)} \\ 317 \vspace{0.02in} 318 319 Here brho is the momentum rigidity, and the conversion constants between current and field are \texttt{\_convHcorr} = 8.14e-4, \texttt{\_convVcorr} = 4.642e-4, \texttt{\_convQt} = 93.83e-4. 320 321 For SOLEIL lattice, the SAME ORDER of multipole field errors on the same elements are added together, 322 so the SAME ORDER of horizontal/vertical, skew quadrupoles, and sextupoles are added together since 323 these elements are integrated at the same magnets. 178 324 179 325 \subsection{ File to define field strength of virtual coupling source elements (SOLEIL lattice)} 180 On SOLEIL storage ring, the coupling is thought to come from the rotation of quadrupoles and vertical displacements of sextupoles. The strengths of these coupling sources are written in a file, then read by the following command: 181 virtualskewquad\_file virtual\_skew\_quad\_currents.txt 182 183 Here âvirtual\_skew\_quad\_currents.txtâ is the user defined file with strength of vertical coupling source. 184 In order to use this command to read the virtual sources of coupling, user needs to define the virtual coupling element as a skew quadrupole in the lattice file: 185 SQ: quadrupole, tilt=45.0, K= 0.0, method=4, N=1; 326 On SOLEIL storage ring, the coupling is thought to come from the rotation of quadrupoles 327 and vertical displacements of sextupoles. The strengths of these coupling sources are 328 written in a file, then read by the following command: 329 \tracycommand{virtualskewquad\_file}{virtual\_skew\_quad\_currents.txt} 330 331 Here \tracypara{virtual\_skew\_quad\_currents.txt} is the user defined file with strength 332 of vertical coupling source. 333 334 In order to use this command to read the virtual sources of coupling, user needs to define 335 the virtual coupling element as a skew quadrupole in the lattice file: 336 \latticedef{SQ:}{quadrupole,}{tilt=45.0, K= 0.0, method=4, N=1;} 186 337 and this virtual coupling element MUST be with the name âSQâ. Now there 152 elements defined as the virtual coupling sources in the SOLEIL lattice. The syntaxs to define skew quadrupole are explained in section . 187 338 The measured current value qtcorr[i] of the ith coupling source is converted to the corresponding integrated skew quadrupole field strength corr\_strength as … … 435 586 \subsection{kick map} 436 587 437 \section{ Commands} 588 589 \section{ Lattice file} 590 In the lattice, RF cavity with the correct harmonic number must be defined!!! 591 Otherwise Tracy will give the error message: 592 \textcolor{red}{Elem\_GetPos: there are no kids in family 0 ()}. This obigatory is for the 593 correct calculation of positive/negtive momentum compaction factor. 594 To deactive the RF cavity, the cavity voltage can be defined as 0. 595 596 597 The followings are the rules to define a lattice file used in Tracy 3. The curvelinear coordinates are 598 used. \textbf{The ideal particle or design particle sees the perfect magnetic field in all magnets, and its} 599 \textbf{orbit is used as the reference orbit and base of the curvilinear coordinate}. Since the reference orbit 600 is a curve inside the dipoles and a straight line in other lattice elements (drifts and the magnets except 601 dipoles), so the length of the dipole is the the path length of the reference particle inside the dipole 602 which is equal to $\rho*\theta$ where $\rho$ is the bending radius of the dipole and $theta$ is the bending angle 603 with unit [rad], and all the other magnet lengths are the straight length of the magnets. 604 605 Due to the same reason, the curvature of the curvilinear cooridnates h = 1/$\rho$ is not zero only inside dipole; 606 in other magnets and drift h = 0, and the curvilinear coordinates goes to cartesian cooridnates. 607 As a result, the independent variable $s$ inside the dipole harmitonian is the arc length, while the staight 608 length in other lattice elements. 609 610 \subsection{Lattice} 611 The $n^{th}$ field component of the lattice element is defined as in Tracy (n = 1, 2, 3, 4 ...): 612 \begin{eqnarray*} 613 b_n & = & \frac{1}{B \rho} \frac{1}{(n-1)!} \frac{\partial^{n-1} B_y }{\partial x ^{n-1}}|_{x=0,y=0} \\ 614 a_n & = & \frac{1}{B \rho} \frac{1}{(n-1)!} \frac{\partial^{n-1} B_x }{\partial x ^{n-1}}|_{x=0,y=0} \\ 615 B \rho & = & \frac{p_0}{e} 616 \end{eqnarray*} 617 $B \rho$ is the magnetic rigidity, $p_0$ is the design beam momentum, $e$ is the electric charge. 618 For example, for sextupole, n = 3, so $b_3$ and $a_3$ are defined as 619 \begin{eqnarray*} 620 b_3 & = & \frac{1}{B \rho} \frac{1}{2} \frac{\partial^{2} B_y }{\partial x ^{2}}|_{x=0,y=0} \\ 621 a_3 & = & \frac{1}{B \rho} \frac{1}{2} \frac{\partial^{2} B_x }{\partial x ^{2}}|_{x=0,y=0} 622 \end{eqnarray*}. 623 624 \notespace{NOTES:} 625 In \textbf{AT} (Accelerator Toolbox) and \textbf{BETA} code, the definition of are the same as in \textbf{Tracy}. 626 While In \textbf{MAD8}, \textbf{MADX} and \textbf{ELEGANT}, the order of the field compoent start from 0, that is 627 n = 0, 1, 2, 3, ..., and the $n^{th}$ field strength components of the lattice element $b_n$ and $a_n$ are defined as 628 \begin{eqnarray*} 629 b_n & = & \frac{1}{B \rho} \frac{\partial^{n} B_y }{\partial x ^{n}}|_{x=0,y=0} \\ 630 a_n & = & \frac{1}{B \rho} \frac{\partial^{n} B_x }{\partial x ^{n}}|_{x=0,y=0} \\ 631 B \rho & = & \frac{p_0}{e} 632 \end{eqnarray*} 633 For example, for sextupole, n = 3, its field component $b_2$ and $a_2$ are defined as 634 \begin{eqnarray*} 635 b_2 & = & \frac{1}{B \rho} \frac{\partial^{2} B_y }{\partial x ^{2}}|_{x=0,y=0} \\ 636 a_2 & = & \frac{1}{B \rho} \frac{\partial^{2} B_x }{\partial x ^{2}}|_{x=0,y=0} 637 \end{eqnarray*}. 638 639 640 641 \subsection{Syntax} 642 Every line embraced by â{}â is comment line. For example: 643 644 {*****drift space *****} 645 646 Each sentence is ended by â;â or no punctuation. 647 Tracy is not sensitive to capital/small letters in the lattice. 648 User can define any lattice element with any valid name (but must start with a character) they want, but the element type is fixed. 649 For the lattice of the ring, the definition of RF cavity is mandatory, and the harmonic number of the RF cavity is also mandatory; for the lattice of the linac, the definition of the RF cavity is optional. 650 651 \subsection{Variables} 652 User can define the variables in the lattice file. For example: 653 \begin{tightcenter} 654 \textsf{Intmeth = 4}; 655 \end{tightcenter} 656 Then when the code is running, the variable \textsf{intmeth} in the lattice 657 file will be replaced by \textsf{4}. 658 659 Tracy accept math operation. For example, 660 \latticedef{DL1: }{drift,}{L = 0.1*2 + 0.1-0.01;} 661 662 \subsection{Start line} 663 The lattice file must begin with the sentence: 664 \begin{tightcenter} 665 \textsf{define} \quad \textsf{lattice}; 666 \end{tightcenter} 667 This definition is mandatory. 668 669 \subsection{Global variables} 670 After define the ring, user needs to define the system parameters of the lattice: 671 Energy, the beam energy with unit [GeV]. 672 dP, the relative momentum offset of the particle. 673 CODeps, the convergence for the algorism to find the closed orbit. 674 For example: 675 Energy = 2.739; 676 dP = 1.0d-10; 677 CODeps= 1.0d-15; 678 These definitions are mandatory. 679 680 \subsection{DRIFT} 681 682 \latticedef{Name:}{drift,}{L = $\langle \dots \rangle$;} 683 684 \begin{table}[htbp] 685 \centering 686 \caption{Parameters of dipole in the lattice file.} 687 \label{tab:dipole-para} 688 %\begin{tabular*}{\linewidth}{@{\extracolsep{\fill}}|p{0.2\linewidth} |p{0.1\linewidth} | p{0.6\linewidth} |} 689 \begin{tabular}{| p{0.2\linewidth} | p{0.2\linewidth} | p{0.1\linewidth} | p{0.4\linewidth} |} 690 \hline 691 \textbf{Parameter Name} & \textbf{Units} &\textbf{Default} & \textbf{Description} \\ 692 \hline 693 \textbf{L} & [m] & 0.0 & Length. \\ 694 \hline 695 \end{tabular} 696 \end{table} 697 The definition of the length of a drift is mandatory. 698 699 \vspace{0.05in} 700 \textit{Example:} 701 \latticedef{SD1a:}{drift,}{L= 0.900000;} 702 703 \subsection{DIPOLE} 704 705 \latticedef{Element\_name:}{bending,}{L = $\langle \dots \rangle$, T = $\langle \dots \rangle$, 706 \textbf{T1} = $\langle \dots \rangle$, \textbf{T2}=$\langle \dots \rangle$, 707 \textbf{H1} = $\lbrack \dots \rbrack$, \textbf{H2}= $\lbrack \dots \rbrack$, 708 \textbf{gap} = $\lbrack \dots \rbrack$, \textbf{edge\_effect1} = $\lbrack \dots \rbrack$, 709 \textbf{edge\_effect2} = $\lbrack \dots \rbrack$, \textbf{K} =$\lbrack \dots \rbrack$, 710 \textbf{method} = $\langle \dots \rangle$, \textbf{N} = $\langle \dots \rangle$;} 711 712 713 714 \begin{table}[tbp] 715 \centering 716 \caption{Parameters of dipole in the lattice file.} 717 \label{tab:dipole-para} 718 %% \begin{tabular*}{\linewidth}{@{\extracolsep{\fill}}|l|c|c|p{0.4\linewidth}|} 719 \begin{tabular}{| p{0.2\linewidth} | p{0.2\linewidth} | p{0.1\linewidth} | p{0.4\linewidth} |} 720 \hline 721 \textbf{Parameter Name} & \textbf{Units} &\textbf{Default} & \textbf{Description} \\ 722 \hline 723 \textbf{L} & [m] & 0.0 & Curved path length of 724 the design particle inside the dipole. L = $\rho * \theta$, where $\rho$ is the 725 bending radius of the dipole, and $\theta$ is the bending angle of the dipole. \\ 726 \hline 727 \textbf{T} &[degree] & 0.0 & Total bending angle \\ 728 \hline 729 \textbf{T1} &[degree] & 0.0 & Entrance angle \\ 730 \hline 731 \textbf{T2} &[degree] & 0.0 & Exit Angle \\ 732 \hline 733 \textbf{K} & L $\neq$ 0, m$^{-2}$. \newline L = 0, m$^{-1}$. & 0.0 734 & L $\neq$ 0, quadrupole field strength; \newline L = 0, integrated field strength. \\ 735 \hline 736 \textbf{Method} & - & 4 & 1,2,4. Symplectic integration method. The 737 value ``1'' means $1^{\mathrm{st}}$ order, ``2'' means $2^{\mathrm{nd}}$ order, 738 and ``4'' means $4^{\mathrm{th}}$ order. \\ 739 \hline 740 \textbf{Gap} &[m] & 0.0 & Distance between two poles of the dipole, 741 the gap size determine the fringe field. If the gap size is 0, then the dipole has 742 no fringe field (\textcolor{red}{??????}). \\ 743 \hline 744 \textbf{edge\_effect1} & - & 0 & 1/0. 745 ``1'' to turn on the edge focusing effect and the fringe field at the entrance of 746 the dipole. ``0'' to turn off the two effects. \\ 747 \hline 748 \textbf{edge\_effect2} & - & 0 & 1/0. ``1'' to turn on the edge focusing effect and the 749 fringe field at the exit of the dipole. ``0'' to turn off the two effects. \\ 750 \hline 751 \textbf{N} & - & 1 & number of cut slices. \\ 752 \hline 753 \end{tabular} 754 \end{table} 755 756 \vspace{0.05in} 757 For example:\\ 758 \vspace{0.05in} 759 \textsf{beta\_gap=37e-3; tracy\_gap=beta\_gap*2*0.724;} 760 \latticedef{BEND1 :}{ \textbf{bending},}{ \textbf{L} = 1.05243, \textbf{T} = 11.25, \textbf{T1} = 5.5906, 761 \textbf{T2} = 5.67658, \textbf{K} = 0.00204,gap=tracy\_gap, 762 \textbf{edge\_effect1} = 1, \textbf{edge\_effect2} = 1, \textbf{N} = 4, 763 \textbf{method} = intmeth;} 764 765 The parameters of ``bending'' are optional, the default values for the missing parameters are 0, 766 and the default value for ``method'' is also 0. 767 768 769 \vspace{0.05in} 770 \textbf{Attention:} 771 \begin{itemize} 772 \item 773 The bending magnet in Tracy is a symplectic element. 774 The independent variable $s$ inside the dipole harmitonian is the arc length, 775 so the length of the dipole is defined the curved path length of the design 776 particle inside the dipole. 777 \item 778 One can refer to the definition of $T1$,$T2$, $H1$, $H2$ on page 116 of SLAC-75 for more 779 information. 780 \item 781 In the lattice files of ELEGANT, MADX and BETA, the dipole angles are defined with the unit [rad]. 782 But in TRACY, the unit is [degree]. 783 \item 784 BETA dipole gap is the Elegant gap; but Tracy dipole gap is different from 785 the definition in both BETA and Elegant. 786 Tracy definition of dipole with fringe field: \\ 787 \textsf{ 788 beta\_gap=0.04; 789 {tracy\_gap=beta\_gap*2*1/6;} 790 {Due to the Tanh-like fringe field, K1=0.2, and tracy\_gap = beta\_gap *2* FINT (K brown para.)} 791 tracy\_gap = beta\_gap*2*0.348;} 792 793 794 \latticedef{DIP:}{bending,}{L=0.27646,T= 45, T1=0, T2=0,gap=tracy\_gap,edge\_effect1=1,edge\_effect2=1,method=intmeth,N=4;} 795 796 Elegant definition of dipole with dipole fringe field: \\ 797 \textsf{DIP: csbend,N\_KICKS=100,INTEGRATION\_ORDER=4,L=0.27646,angle= 0.785398, E1=0, E2=0,hgap=0.02,Fint=0.348,nonlinear=1,edge1\_effects=2,edge2\_effects=2,edge\_order=2;} 798 \end{itemize} 799 800 \subsection{QUADRUPOLE} 801 \textbf{Definition:} \\ 802 \latticedef{Element\_Name:}{ quadrupole,}{ L = $\lbrack \dots \rbrack$, tilt = $\lbrack \dots \rbrack$, 803 K =$\lbrack \dots \rbrack$, FF1 = $\lbrack \dots \rbrack$, 804 FF2= $\lbrack \dots \rbrack$, FFscaling = $\lbrack \dots \rbrack$, 805 method = $\lbrack \dots \rbrack$, N= $\langle \dots \rangle$;} 806 807 \begin{table}[htbp] 808 \centering 809 \caption{Parameters of quadrupoles in the lattice file.} 810 \label{tab:quad-para} 811 \begin{tabular}{| p{0.2\linewidth} | p{0.2\linewidth} | p{0.1\linewidth} | p{0.4\linewidth} |} 812 \hline 813 \textbf{Parameter Name} & \textbf{Units} &\textbf{Default} & \textbf{Description} \\ 814 \hline 815 L & [m] & 0.0 & Length of the quadrupole \\ 816 \hline 817 Tilt & [degree] & 0.0 & tilt angle of the quadrupole. 818 If âtiltâ is non-zero, then the 819 quadrupole is a skew quadruple. \\ 820 \hline 821 K & L $\neq$ 0, [m$^{-2}$]. \newline L = 0, [m$^{-1}$]. & 0.0 & L $\neq$ 0, Gradient 822 $\frac{\frac{\partial B_y }{\partial x}}{B \rho}$; \newline L = 0, integrated field strength 823 $\frac{\frac{\partial B_y }{\partial x} L }{B \rho}$. \\ 824 \hline 825 FF1 & - & 0 & 1 or 0. \newline 826 1: to avtive fringe field at the left edge. \textsf{QuadFringeOnFlag} 827 should be set in the Tracy input file. 0: left fringe field off. \\ 828 \hline 829 FF2 & - & 0 & 1 or 0. \newline 830 1: to avtive fringe field at the right edge. \textsf{QuadFringeOnFlag} 831 should be set in the Tracy input file. 0: right fringe field off. \\ 832 \hline 833 FFscaling & - & 1 & Scaling factor of the dipole fringe field. \\ 834 \hline 835 Method & - & 4 & 1,2,4. Order of symplectic integration method. 836 Value ``1'' means 1st order, ``2'' means 2nd order, and ``4'' means 4th order. \\ 837 \hline 838 N & - & 1 & Pieces of the quadrupole to be cut when it is treated in the code. \\ 839 \hline 840 \end{tabular} 841 \end{table} 842 843 844 845 Example: \\ 846 847 \textsf{Nq=8/2; dgsurg=1.00; dgsurgL=1.00; quadfringe=1.0; LQC=0.3602;} 848 \latticedef{QP1a:}{quadrupole,}{ L=LQC/2, K= -1.073038*dgsurg, FF1=quadfringe, FF2=0, 849 FFscaling =1, method=intmeth, N=Nq;} 850 851 The parameters of âquadrupoleâ are optional, the default value for âmethodâ is 4, the default value for âFFscalingâ is 1, the default value for the other parameters are 0. 852 853 \subsection{SKEW QUADRUPOLE} 854 855 The skew quadrupole is a quadrupole with a 45 [degree] tilt angle. For example: 856 \latticedef{QT:}{quadrupole,}{tilt=45.0, K= 0.0, method=intmeth, N=1;} 857 858 \notespace{NOTES:} 859 If skew quadrupoles are defined in the lattice file with a name \tracypara{skewquad}, 860 User must specify the name of skew quadrupole in the tracy input file using 861 the commands: 862 \tracycommand{qt}{skewquad} 863 864 \subsection{SEXTUPOLE} 865 866 \latticedef{Element\_Name:}{sextupole,}{L = $\lbrack \dots \rbrack$, K = $\lbrack \dots \rbrack$, 867 FF1 = $\lbrack \dots \rbrack$, FF2=$\lbrack \dots \rbrack$,method = $\lbrack \dots \rbrack$, 868 N=$\lbrack \dots \rbrack$;} 869 870 871 \begin{table}[htpb] 872 \centering 873 \caption{Parameters of sextupoles in the lattice file.} 874 \label{tab:sext-para} 875 \begin{tabular}{| p{0.2\linewidth} | p{0.2\linewidth} | p{0.1\linewidth} | p{0.4\linewidth} |} 876 \hline 877 \textbf{Parameter Name} & \textbf{Units} &\textbf{Default} & \textbf{Description} \\ 878 \hline 879 \textbf{L} [m] & & 0.0 & Length\\ 880 \hline 881 \textbf{K} &L $\neq$ 0, [m$^{-3}$]. \newline L = 0, [m$^{-2}$]. & 0.0 & 882 If L $\neq$ 0, 883 $K = \frac{1}{2} \frac{1}{B \rho} \frac{\partial^{2} B_y }{\partial x ^{2}}|_{x=0,y=0}$, 884 $B \rho$ is the magnetic rigidity, $p_0$ is the design beam momentum, 885 $e$ is the electric charge. If L = 0, K is the integrated field 886 strength $L\frac{1}{2} \frac{1}{B \rho} \frac{\partial^{2} B_y }{\partial x ^{2}}|_{x=0,y=0}$ \\ 887 \hline 888 \textbf{FF1} & - & 0 & \textbf{1} or \textbf{0}. \textbf{1}: tringe on the fringe field at the 889 left edge. \textbf{0}: tringe off the fringe field at the 890 left edge.\\ 891 \hline 892 \textbf{FF2} & - & 0 & \textbf{1} or \textbf{0}. \textbf{1}: tringe on the fringe field at the 893 right edge. \textbf{0}: tringe off the fringe field at the 894 right edge.\\ 895 \hline 896 \textbf{Method} & - & 4 & \textbf{1},\textbf{2},\textbf{4}. Order of symplectic integration method. 897 \textbf{1}: 1st order; \textbf{2}: 2nd order; \textbf{4} 4th order. \\ 898 \hline 899 \textbf{N} & - & 1 & Pieces of this element to be cut, used in the symplectic 900 integration. \\ 901 902 \hline 903 \end{tabular} 904 \end{table} 905 906 907 908 \textit{Example:} \\ 909 \textsf{NqSx=1; coef=1.0/0.16; method4sextu = 4; sextfringe = 0;} 910 \latticedef{SX1:}{sextupole,}{ L=0.16, K = 1.719190*coef, method=method4sextu, N = NqSx, 911 FF1=sextfringe, FF2=sextfringe;} 912 913 The parameters of âsextupoleâ are optional, the default value for âmethodâ is 4, 914 the default value for the other parameters is 0. 915 916 917 \notespace{NOTES:} 918 919 In \textbf{AT} (Accelerator Toolbox) and \textbf{BETA} code, the european notation of 920 the order of magnetic field is used. That is n = 1, 2, 3, ...n; and the definition of 921 K are the same as in \textbf{Tracy}. 922 While In \textbf{MAD8}, \textbf{MADX} and \textbf{ELEGANT}, the U.S. notation of the 923 order order of the field is used, that is n = 0, 1, 2, 3, ..n. For sextupole, n = 2, 924 and its gradient is defined as 925 \begin{equation*} 926 K_2 = \frac{1}{B \rho} \frac{\partial^{2} B_y }{\partial x ^{2}}|_{x=0,y=0} 927 \end{equation*} 928 929 \subsection{MULTIPOLE} 930 931 \latticedef{Element\_Name:}{Multipole,}{L= $\lbrack \dots \rbrack$, T =$\lbrack \dots \rbrack$, 932 T1=$\lbrack \dots \rbrack$, T2=$\lbrack \dots \rbrack$, 933 tilt=$\lbrack \dots \rbrack$, HOM = (i, $\langle$ $b_i$ $\rangle$, $\langle$ $a_i$ $\rangle$, 934 j, $\langle$ $b_j$ $\rangle$, $\langle$ $a_j$ $\rangle$,âŠ.$n$, $\langle$ $b_n$ $\rangle$, $\langle$ 935 $a_n$ $\rangle$), $N$ =$\lbrack \dots \rbrack$$\langle$, method =$\lbrack \dots \rbrack$;} 936 937 \begin{table}[htpb] 938 \centering 939 \caption{Parameters of the multipoles.} 940 \label{tab:mult-para} 941 \begin{tabular}{| p{0.2\linewidth} | p{0.2\linewidth} | p{0.1\linewidth} | p{0.4\linewidth} |} 942 \hline 943 \textbf{Parameter Name} & \textbf{Units} &\textbf{Default} & \textbf{Description} \\ 944 \hline 945 \textbf{L} & [m] & 0.0 & Length \\ 946 \hline 947 \textbf{T} & [degree] & 0.0 & Total bending angle \\ 948 \hline 949 \textbf{T1} & [degree] & 0.0 & Entrance angle \\ 950 \hline 951 \textbf{T2} & [degree] & 0.0 & Exit Angle \\ 952 \hline 953 \textbf{Tilt} & [degree] & 0.0 & Rotation angle of the quadrupole; if \tracypara{Tilt} 954 is non-zero, then the quadrupole is a skew quadruple.???? \\ 955 \hline 956 \textbf{HOM} & - & (0, 0, 0) & Multipole field components of the element. The format 957 is \textit{n}, \textit{$b_{n}$}, \textit{$a_n$}, etc. \newline 958 \textit{n} is order of the multipole 959 field in U.S. notation (?????), n=1 (dipole field), 960 n=2 (quadrupole field), n=3 (sextupole field), 961 n=4 (octuple field), n=5 (decuple field). 962 \textit{$b_n$} is $n^{\mathrm{th}}$ component of the upright multipole 963 field with the unit [$\frac{1}{m^{-n}}$]; 964 \textit{$a_n$} is $n^{\mathrm{th}}$ component 965 of the skew multipole field with the 966 unit [$\frac{1}{m^-n}$]. \\ 967 \hline 968 \textbf{N} & - & 1 & Pieces of this element to be cut \\ 969 \hline 970 \textbf{Method} & - & 4 & 1,2,4. Symplectic integration method. 971 1 is $1^{\mathrm{st}}$ order, 2 is $2^{\mathrm{nd}}$ order, 4 is 972 $4\mathrm{th}$ order. \\ 973 \hline 974 \end{tabular} 975 \end{table} 976 977 The multipole field components $a_n$ and $b_n$ are defined as 978 \begin{eqnarray} 979 b_n & = & \frac{1}{B \rho} \frac{1}{(n-1)!} \frac{\partial^{n-1} B_y }{\partial x ^{n-1}}|_{x=0,y=0} \\ 980 a_n & = & \frac{1}{B \rho} \frac{1}{(n-1)!} \frac{\partial^{n-1} B_x }{\partial x ^{n-1}}|_{x=0,y=0} \\ 981 B \rho & = & \frac{p_0}{e} 982 \end{eqnarray} 983 $B \rho$ is the magnetic rigidity, $p_0$ is the design beam momentum, $e$ is the electric charge. 984 985 If the magnetic field $\vec{B^{tip}}$ is measured at the location with the radius $r_0$, then 986 $b_n$ and $a_n$ are defined as 987 \begin{eqnarray*} 988 b_n & = & \frac{1}{B \rho} \frac{B_y^{tip}}{r_0^{n-1}}\\ 989 a_n & = & \frac{1}{B \rho} \frac{B_x^{tip}}{r_0^{n-1}} \\ 990 \vec{B^{tip}} & = & B_y^{tip} \hat{y} + B_x^{tip} \hat{x} 991 \end{eqnarray*} 992 993 The $n^{th}$ order magnetic field is 994 \begin{equation} 995 B_y^n + i * B_x^n = (b_n + i*a_n) * (x + i*y)^n 996 \end{equation} 997 The total magnetic field with $1^{st}$ to $n^{th}$ order field components can be calculated using 998 \begin{eqnarray} 999 \label{eqn:total:field} 1000 B_y + i * B_x & = & (b_n + i*a_n) * (x+i*y)*(x + i*y)^{n-1} + O(n-1) \\ 1001 & = & [(b_n*x - a_n*y) + b_{n-1} + i*(a_n*x + b_n*y + a_{n-1})]*(x+i*y)^{n-1} + O(n-2) \\ 1002 & ...& 1003 \end{eqnarray} 1004 1005 The eqn.~\ref{eqn:total:field} is used in Tracy3 to calculate the effective fields of the 1006 magnet. This equation clearly shows that, all the field errors gives the same effect the 1007 beam: horizontal focusing and vertical decusing. But since the field strength of the 1008 $n^{th}$ order magnet is proportial to the $n^{th}$ order of $x/y$ and $x/y$ at the 1009 entrance of the magnet is small, so the higher $n$ is, the weak of the $n^{th}$ order 1010 multipole field is. 1011 1012 \vspace{0.05in} 1013 \textit{Example 1: } 1014 1015 \latticedef{B:}{multipole,}{L=0.70, T=10.0, T1=5.0, T2=5.0, HOM = (1, -1.0, 0), N=8, Method=2;} 1016 1017 In this example, the multipole is a dipole with field component $b_1$ = -1.0, or the 1018 field strength is $B_{y0}$, and the field direction is down. This field gives a horizontal 1019 focusing to the electron. 1020 1021 \vspace{0.05in} 1022 \textit{Example 2:} 1023 1024 \latticedef{QF:}{multipole,}{L=0.70, HOM = (1, 2.50, 0.0, 4, 1.01e7, 0.0), N=8, Method=4;} 1025 1026 In this example, the multipole is a dipole with $4^{th}$ order upright multipole filed errors (octupole), 1027 and $b_4$ = 1.01e7. 1028 1029 To add multipole errors in the defined lattice files, user can also define the multipoles 1030 inside an external file (Section~\ref{sec:mult:field:error}) (???? To be checked, can this 1031 routine mesured with the general one???). 1032 1033 \notespace{NOTES:} \\ 1034 In \textbf{AT} (Accelerator Toolbox) and \textbf{BETA} code, the definition of are the same 1035 as in \textbf{Tracy}. While In \textbf{MAD8}, \textbf{MADX} and \textbf{ELEGANT}, the order 1036 of the field compoent start from 0, that is n = 0, 1, 2, 3, ..., and the $n^{th}$ field 1037 strength components of the lattice element $b_n$ and $a_n$ are defined as 1038 \begin{eqnarray*} 1039 b_n & = & \frac{1}{B \rho} \frac{\partial^{n} B_y }{\partial x ^{n}}|_{x=0,y=0} \\ 1040 a_n & = & \frac{1}{B \rho} \frac{\partial^{n} B_x }{\partial x ^{n}}|_{x=0,y=0} \\ 1041 B \rho & = & \frac{p_0}{e} 1042 \end{eqnarray*} 1043 1044 \subsection{ wiggler (To be updated.)} 1045 1046 \latticedef{Element\_Name:}{Wiggler,}{L = $\langle$ length $\rangle$,BoBrhoV = $\langle$ B/Brho $\rangle$, 1047 BoBrhoH = $\langle$ B/Brho $\rangle$, Lambda = $\langle$ period $\rangle$,kxV= $\langle$ [m] $\rangle$,kxH = $\langle$ [m] $\rangle$,phi = $\langle$ phase $\rangle$, 1048 harm(n, kxV, BoBrhoV, kxH, BoBrhoH, phi), N = $\langle$ no of integration steps $\rangle$, 1049 Method = $\langle$ method $\rangle$;} 1050 1051 1052 \begin{table}[htbp] 1053 \centering 1054 \caption{The parameters of wigglers in a lattice file.} 1055 \label{tab:wiggler-para} 1056 \begin{tabular}{| p{0.2\linewidth} | p{0.2\linewidth} | p{0.1\linewidth} | p{0.4\linewidth} |} 1057 \hline 1058 \textbf{Parameter Name} & \textbf{Units} &\textbf{Default} & \textbf{Description} \\ 1059 \textbf{L} & [m] & 0.0 & Length \\ \hline 1060 \textbf{BoBrhoV} & ??? & ??? & the normalized vertical field \\ \hline 1061 \textbf{BoBrhoH} & ??? & ??? & the normalized horizontal field \\ \hline 1062 \textbf{Labmda} & [m] & ??? & period length \\ \hline 1063 \textbf{kxV} & [m] & ??? & ??? \\ \hline 1064 \textbf{kxH} & [m] & ??? & ??? \\ \hline 1065 \textbf{phi} & [degree] & ??? & ??? \\ \hline 1066 \textbf{harm} & ??? & ??? & ??? \\ \hline 1067 \textbf{N} & - & - & No of integration steps \\ \hline 1068 \textbf{Method} & - & - & Symplectic integration method. 1069 1 is 1st order, 2 is 2nd order, 4 is 4th order.\\ 1070 \hline 1071 \end{tabular} 1072 \end{table} 1073 1074 \vspace{0.05in} 1075 \textit{ Example 1:} 1076 \latticedef{U143:}{wiggler,}{L=4.80, K=0.5, Lambda=0.15, N=20, Method=0;} 1077 1078 \vspace{0.05in} 1079 \textit{Example 2:} 1080 \latticedef{EPU:}{wiggler,}{L=4.80, Lambda=0.15, N=20, Method=0, 1081 harm=(3, kxV\_3, BoBrhoV\_3, kxH\_3, BoBrhoH\_3, phi\_3);} 1082 1083 \subsection{FIELD MAP (To be updatedâŠâŠ..)} 1084 1085 \latticedef{Element\_Name:}{Fieldmap,}{L = $\langle$ length [m] $\rangle$, N = $\langle$ 1086 no of integration steps $\rangle$, file1 = $\langle$ file name (lower case) $\rangle$}; 1087 1088 \begin{table}[htbp] 1089 \centering 1090 \caption{Parameters of field map in the lattice file.} 1091 \label{tab:fieldmap-para} 1092 \begin{tabular}{| p{0.2\linewidth} | p{0.2\linewidth} | p{0.1\linewidth} | p{0.4\linewidth} |} 1093 \hline 1094 \textbf{Parameter Name} & \textbf{Units} &\textbf{Default} & \textbf{Description} \\ 1095 \hline 1096 \textbf{L} & [m] & 0.0 & Length \\ \hline 1097 \textbf{L} & [m] & 0.0 & Length of the field map \\ 1098 \hline 1099 \textbf{N} & - & ??? & the number of integration steps \\ 1100 \hline 1101 \textbf{file1} & - & ??? & field map file \\ 1102 \hline 1103 \end{tabular} 1104 \end{table} 1105 1106 \vspace{0.05in} 1107 \textit{Example:} 1108 \latticedef{FM:}{Fieldmap,}{L = 1.0, N = 20, file1 = "U19\_Bxyz.dat";} 1109 1110 1111 \subsection{INSERTION DEVICE} 1112 1113 \latticedef{Element\_Name:}{insertion,}{scaling1 = 1/0, scaling2=1/0,method = interpolation\_method, 1114 N=Number of slice, file1 = name of the file with 1st order radia map, 1115 file2 = name of the file with 2nd order radia map;} 1116 1117 \begin{table}[htbp] 1118 \centering 1119 \caption{Parameters of the insertion devices.} 1120 \label{tab:insertiondevice-para} 1121 \begin{tabular}{| p{0.2\linewidth} | p{0.2\linewidth} | p{0.1\linewidth} | p{0.4\linewidth} |} 1122 \hline 1123 \textbf{Parameter Name} & \textbf{Units} &\textbf{Default} & \textbf{Description} \\ 1124 \textbf{scaling1} & - & ??? & scaling factor for the 1st order field map \\ 1125 \hline 1126 \textbf{scaling2} & - & ??? & scaling factor for the 2rd order field map \\ 1127 \hline 1128 \textbf{method} & - & ??? & 1, 3. The order of symplectic interpolation method. 1 is linear 1129 interpolation, 3 is spline interpolation.\\ 1130 \hline 1131 \textbf{N} & - & ??? & pieces of this element is cut when it is treated in the code \\ 1132 \hline 1133 \textbf{file1} & - & ??? & The 1st order of insertion device field are read from the 1134 files generated by RADIA. If user does not specify the file name with the file path, 1135 then the code will look for the files in the current working directory. The path of 1136 the Radia map file must be in small letters, otherwise the code canât find the file. \\ 1137 \hline 1138 \textbf{file2} & - & ??? & 1139 The 2nd order of insertion device field are read from the files generated by RADIA. 1140 If user does not specify the file name with the file path, then the code will look 1141 for the files in the current working directory. The path of the Radia map file must 1142 be in small letters, otherwise the code canât find the file. \\ 1143 \hline 1144 \end{tabular} 1145 \end{table} 1146 1147 \vspace{0.05in} 1148 \textit{Example:} 1149 \latticedef{WIGSLIC:}{insertion,}{N = 10, scaling1=1.0, scaling2=1.0, method=2, file1="/home/sources/physmach/tracy2.7/w150g11pole60\_oppose\_radia\_pour\_tracy.txt", file2= "/home/sources/physmach/brunelle/tracy-2.7/w150g11pole20\_fin.dat";} 1150 1151 All the parameters for âinsertionâ is optional, the default value for scaling1 and scaling2 are 1, 1152 the default âmethodâ is 3 which means spline interpolation, the default âNâ is 1, the default 1153 values for all the other parameters are 0. 1154 1155 \subsection{RF CAVITY} 1156 1157 \latticedef{Element\_Name}{cavity,}{Frequency = RF frequency, Voltage = RF voltage, Phase = synchrotron 1158 Phase, harnum = harmonic number of the RF cavity;} 1159 1160 1161 \begin{table}[htbp] 1162 \centering 1163 \caption{Parameters of RF cacity.} 1164 \label{tab:RFCavity-para} 1165 \begin{tabular}{| p{0.2\linewidth} | p{0.2\linewidth} | p{0.1\linewidth} | p{0.4\linewidth} |} 1166 \hline 1167 \textbf{Parameter Name} & \textbf{Units} &\textbf{Default} & \textbf{Description} \\ 1168 \hline 1169 \textbf{frequency} & [Hz] & ??? & RF frequency \\ 1170 \hline 1171 \textbf{voltage} & [Volt] & ??? & RF voltage \\ 1172 \hline 1173 \textbf{phase} & [degree] & ??? & synchrotron phase \\ 1174 \hline 1175 \textbf{harnum} & - & ??? & harmonic number \\ 1176 \hline 1177 \end{tabular} 1178 \end{table} 1179 1180 1181 \vspace{0.05in} 1182 \textit{Example:} 1183 \latticedef{CAV:}{Cavity,}{Frequency = 499.95e6, Voltage=1.22e6, phase = 30, harnum=328;} 1184 1185 The harmonic number of the RF cavity is mandatory, and the other parameters of âcavityâ are 1186 optional, the default values are 0. 1187 1188 \subsection{CORRECTOR} 1189 1190 \latticedef{Element\_Name:}{corrector,}{horizontal/vertical, method = integrated method;} 1191 1192 \begin{table}[htbp] 1193 \centering 1194 \caption{Parameters of correctors.} 1195 \label{tab:corrector-para} 1196 \begin{tabular}{| p{0.2\linewidth} | p{0.2\linewidth} | p{0.1\linewidth} | p{0.4\linewidth} |} 1197 \hline 1198 \textbf{Horizontal / vertical} & - & ??? & âhorizontalâ: horizontal corrector; âverticalâ: vertical 1199 corrector \\ 1200 \hline 1201 \textbf{method} & - & ??? & 1, 2, 4. Order of symplectic integration method. 1202 Value â1â means 1st order, â2â means 2nd order, and â4â means 4th order \\ 1203 \hline 1204 \end{tabular} 1205 \end{table} 1206 1207 1208 \vspace{0.05in} 1209 \textit{Example 1:} 1210 \latticedef{CH:}{corrector,}{horizontal, method=intmeth;} 1211 It defines a horizontal corrector. 1212 1213 \vspace{0.05in} 1214 \textit{Example 2:} 1215 \latticedef{CV:}{corrector,}{vertical, method=intmeth;} 1216 It defines a vertical corrector. 1217 1218 The parameters of âcorrectorâ are optional, the default value for âmethodâ is 0. 1219 1220 \notespace{NOTES:} 1221 For a lattice with correctors, user must specify the name of corrector in the Tracy 1222 input file with the commands: 1223 \tracycommand{h\_corr}{HCM} 1224 or 1225 \tracycommand{v\_corr}{VCM} 1226 Here \tracypara{HCM} is the name of the corrector defined in the lattice for horizontal 1227 orbit correction (????); \tracypara{VCM} is the name of the corrector defined in the 1228 lattice for vertical orbit correction. 1229 1230 1231 \subsection{MARKER} 1232 1233 \latticedef{Element\_Name:}{marker;}{} 1234 1235 \subsection{BEAM POSITION MONITOR (To be updated)} 1236 BPM is a special marker in the lattice; the âsymbolâ name must be âBPMâ (???). User can 1237 define the BPM as:???? 1238 \latticedef{BPM:}{type;}{} 1239 1240 Normally Its type is defined as âMarkerâ type, but in order to include the misalignment 1241 error of BPM into the lattice, it must be defined as âBeam Position Monitorâ type 1242 which is in fact multipole type, since only the element with multipole type is saved 1243 with displacement error, field error, etc. 1244 1245 \notespace{NOTES:} 1246 For lattice with BPMs, user must specify the name of BPM in the Tracy input file 1247 with the command: 1248 \latticedef{bpm}{beaPosMonitor} 1249 Here âbeaPosMonitorâ is the name of the BPMs defined in the lattice. 1250 1251 \subsection{GIRDER} 1252 Girder is a special element, itâs the girder used in the real machine to support the magnetic elements and other elements. It is defined as: 1253 Symbol: type; 1254 1255 Normally Its type is defined as âMarkerâ type, but in order to include the misalignment error of girder into the lattice, it must be defined as âmultipoleâ type, since only the element with multipole type is saved with displacement error, field error, etc. 1256 For convenience, itâs better to define the beginning of the girder and also the end of the girder, and the elements between the beginning and end of the girders are the elements who are put on the girder in the real machine. 1257 1258 Notice: 1259 For lattice with girders, 1260 User must specify the name of girder in the input file â*.prmâ with the commands: 1261 gs Girder\_Start 1262 ge Girder\_End 1263 1264 Here âGirder\_Startâ is the name of the start of girder defined in the lattice; âGirder\_Endâ is the name of the end of girder defined in the lattice. 1265 1266 \subsection{SOLENOID...TO BE UPDATED...} 1267 1268 1269 \subsection{ELEMENT BLOCK} 1270 To construct the element block, use the following format: 1271 Symbol: elem1, elem2,âŠ., block1,block2; 1272 Here âSymbolâ is the name of the element block, and âelem1â, âelem2â, âblock1â, âblock2â are the element or sub element blocks in this element block. 1273 If there are N the same element/block subsequently, user can use âN*element/blockâ to simply the definition. For example: 1274 SINJ: SD1a, ssep, 3*SEP,esep,SD1c,eHU600,SD1d; 1275 In this example element block, there are 9 elements/blocks, and 3 elements/blocks âSEPâ subsequently. 1276 1277 \subsection{LINE} 1278 User can define the cell structure using the command: 1279 1280 CELL : $\langle$ block name $\rangle$, SYMMETRY=$\langle$ symmetry $\rangle$; 1281 1282 $\langle$ block name $\rangle$ is the name of a block; $\langle$ symmetry $\rangle$ is the number of super symmetry or the number of the block in the ring. 1283 1284 Example: 1285 1286 CELL: BL1, Symmetry=12; 1287 1288 This example defines the cell with block âBL1â, and the number of super symmetry is 12. The output of the Tracy3 with symmetry large than 1 will give the 1289 tunes and chromaticities in one symmetric period. 1290 1291 \subsection{RING} 1292 To define the ring, use the command: 1293 RING: elem, blockâŠ. 1294 Itâs similar to define an element block, but must with the fixed symbol name âRINGâ. For example: 1295 RING: DEBUT,SUP1,SUP2,SUP3,SUP4,CAV,FIN; 1296 5.1.23 End line 1297 To end the lattice file, user needs to use the following command at the end of the lattice file: 1298 End; 1299 This command is mandatory. 1300 1301 1302 \section{Commands} 438 1303 The following commands turn on the boolean flags in the code to set the machine parameters and carry on different calculations. All these commands are optional; user can choose whichever they need. If user wants to use the flag, they can write the flag in the script, if they do not want to use it, they can delete or comment out (add â\#â at the beginning of command line) the flag. The Boolean flags in the user input script have the following features: 439 1304 If the flags are not active, then the default values for all the boolean commands are false. … … 472 1337 473 1338 The parameters and the default values of âPrintTrackFlagâ are shown in Table . 1339 1340 \begin{table}[h] 1341 \centering 1342 \caption{} 1343 \label{} 1344 \begin{tabular*}{\linewidth}{@{\extracolsep{\fill}}|p{0.2\linewidth} |p{0.5\linewidth} | p{0.15\linewidth} |} 1345 \hline 1346 \hline 1347 \end{tabular*} 1348 \end{table} 1349 474 1350 Table Parameters of command "PrintTrackFlag". 475 1351 Name … … 512 1388 - 513 1389 1390 \subsection{PrintTrackElemFlag} 1391 To print the coordinates tracked (NOT around COD) at a certain element to a file, use the command: 1392 PrintTrackFlag track\_file x px y py delta ctau nelem1 nelem2 1393 1394 For example: 1395 PrintTrackFlag track.out 0.001 0.0 0.0 0.0 0.0 0.0 50 1 2 1396 1397 The parameters and the default values of âPrintTrackElemFlagâ are shown in Table . 1398 1399 \begin{table}[h] 1400 \centering 1401 \caption{} 1402 \label{} 1403 \begin{tabular*}{\linewidth}{@{\extracolsep{\fill}}|p{0.2\linewidth} |p{0.5\linewidth} | p{0.15\linewidth} |} 1404 \hline 1405 \hline 1406 \end{tabular*} 1407 \end{table} 1408 1409 Table Parameters of command "PrintTrackElemFlag". 1410 Name 1411 Description 1412 Default value 1413 Unit 1414 track\_file 1415 File to save the tracked coordinates around each lattice element 1416 track.out 1417 - 1418 x 1419 Start tracking horizontal coordinate 1420 0.001 1421 [m] 1422 px 1423 Start tracking horizontal canonical momentum px normalized by reference momentum p0, that is: px = px/p0. Normally px is approximate as horizontal deviation with unit [rad]. 1424 0.0 1425 1426 - 1427 y 1428 Start tracking vertical coordinate 1429 0.0 1430 [m] 1431 py 1432 Start tracking vertical canonical momentum py normalized by reference momentum p0, that is: py = py/p0. Normally px is approximate as vertical deviation with unit [rad]. 1433 0.0 1434 1435 - 1436 delta 1437 Start tracking relative energy offset 1438 0.0 1439 - 1440 ctau 1441 Start tracking longitudinal coordinate 1442 0.0 1443 [m] 1444 nelem1 1445 index of start lattice element for tracking 1446 1447 nelem2 1448 index of end lattice element for tracking 1449 514 1450 \subsection{PrintTwissFlag} 515 1451 … … 533 1469 \# 534 1470 Where â\#â denotes the command line, the meanings of the above parameters are shown in Table . 1471 1472 \begin{table}[h] 1473 \centering 1474 \caption{} 1475 \label{} 1476 \begin{tabular*}{\linewidth}{@{\extracolsep{\fill}}|p{0.2\linewidth} |p{0.5\linewidth} | p{0.15\linewidth} |} 1477 \hline 1478 \hline 1479 \end{tabular*} 1480 \end{table} 1481 535 1482 Table Parameters in the output file of close orbit. 536 1483 Name … … 665 1612 666 1613 The meanings of parameters and default values of command âAmplitudeTuneShiftFlagâ are shown in Table . If user uses the command AmplitudeTuneShiftFlag without parameters, then the code will use all the default values. 1614 1615 \begin{table}[h] 1616 \centering 1617 \caption{} 1618 \label{} 1619 \begin{tabular*}{\linewidth}{@{\extracolsep{\fill}}|p{0.2\linewidth} |p{0.5\linewidth} | p{0.15\linewidth} |} 1620 \hline 1621 \hline 1622 \end{tabular*} 1623 \end{table} 1624 667 1625 Table Parameters of the command to calculate tune shift with amplitude 668 1626 Parameters … … 704 1662 The meaning of parameters and default values of this command are shown in Table . 705 1663 If user uses command EnergyTuneShiftFlag without parameters, then the code will use all the default values. 1664 1665 \begin{table}[h] 1666 \centering 1667 \caption{} 1668 \label{} 1669 \begin{tabular*}{\linewidth}{@{\extracolsep{\fill}}|p{0.2\linewidth} |p{0.5\linewidth} | p{0.15\linewidth} |} 1670 \hline 1671 \hline 1672 \end{tabular*} 1673 \end{table} 1674 706 1675 Table Parameters of the command to calculate tune shift with energy 707 1676 parameter … … 722 1691 723 1692 \subsection{FmapFlag} 724 Frequency map analysis for on momentum particle 1693 Frequency map analysis for on momentum particle. 1694 Track the coordinates (x, px, y, py, delta, ctau) of the particle, 1695 the coordinates (x, px, y, py) are tracked around the closed orbit; 1696 while (delta, ctau) is tracked around the zero orbit. 1697 1698 The grid of the particle is x= 1e-6 + xcod ~ xmax + xcod, with the 1699 step size xmax/nturn, 1700 z= 1e-6 + zcod ~ zmax + zcod, with the 1701 step size ymax/nturn; px = 0 + pxcod; pz = 0 + pzcod; 1702 ctau = 0; delta = set value. 725 1703 726 1704 To do frequency map analysis for the on momentum particle, use the command: 727 FmapFlag fmap\_file nxpoint nypoint nturn xmax ymax delta diffusion 1705 FmapFlag fmap\_file nxpoint nypoint nturn xmax ymax delta diffusion \\ 1706 or 1707 FmapFlag fmap\_file nxpoint nypoint nturn xmax ymax delta diffusion printloss \\ 1708 728 1709 For example: 729 FmapFlag fmap.out 31 21 516 0.025 0.005 0.0 true 1710 FmapFlag fmap.out 31 21 516 0.025 0.005 0.0 true 1711 or 1712 FmapFlag fmap.out 31 21 516 0.025 0.005 0.0 true true 1713 1714 730 1715 The meaning of parameters and default values of this command are shown in Table . If user uses command FmapFlag without parameters, then the code will use all the default values. 1716 1717 \begin{table}[h] 1718 \centering 1719 \caption{} 1720 \label{} 1721 \begin{tabular*}{\linewidth}{@{\extracolsep{\fill}}|p{0.2\linewidth} |p{0.5\linewidth} | p{0.15\linewidth} |} 1722 \hline 1723 \hline 1724 \end{tabular*} 1725 \end{table} 1726 731 1727 Table Parameters of the command to do frequency map analysis for on momentum particle. 732 1728 Parameters … … 743 1739 21 744 1740 nturn 745 Number of turns for tracking 1741 Number of turns for tracking; if ``diffusion'' is 1742 true, then the tunes will calculated in the first Nturn 1743 and then the second Nturn, and the tune difference 1744 between these two tunes is the tune diffusion. 746 1745 516 747 1746 xmax … … 755 1754 0.0 756 1755 diffusion 757 Boolean flag to compute tune diffusion1756 Boolean flag, true/false; to compute tune diffusion at the first N turns and second N turns. 758 1757 true 759 1758 1759 printloss (optional) 1760 Boolean flag, true/flase; print out the last information of the tracked particleto and external file? If true, the output file is ``fmap\_file.loss''. 760 1761 \subsection{FmapdpFlag} 761 1762 Frequency map analysis for off momentum particle \\ … … 763 1764 To do frequency map analysis for the off momentum particle, use the command: 764 1765 FmapdpFlag fmapdp\_file nxpoint nepoint nturn xmax emax y diffusion 1766 or 1767 FmapdpFlag fmapdp\_file nxpoint nepoint nturn xmax emax y diffusion printloss 1768 765 1769 The meaning of parameters and default values are shown in Table . If user only uses the command FmapdpFlag but without defining all the parameters, then the code uses the default values. 1770 1771 \begin{table}[h] 1772 \centering 1773 \caption{} 1774 \label{} 1775 \begin{tabular*}{\linewidth}{@{\extracolsep{\fill}}|p{0.2\linewidth} |p{0.5\linewidth} | p{0.15\linewidth} |} 1776 \hline 1777 \hline 1778 \end{tabular*} 1779 \end{table} 1780 766 1781 Table Parameters of the command âFmapdpFlagâ. 767 1782 parameters … … 793 1808 true 794 1809 1810 printloss (optional) 1811 Boolean flag, true/flase; print out the last information of the tracked particleto and external file? If true, the output file is ``fmapdp\_file.loss''. 1812 1813 795 1814 \subsection{ErrorCouplingFlag} 796 1815 Add coupling by the random rotation of the full quadrupoles \\ … … 827 1846 -0.05 100 1026 0.0001 828 1847 The meaning of parameters and default values are shown in Table . If user uses MomentumAccFlag without parameters, then the code will use the default values. 1848 1849 \begin{table}[h] 1850 \centering 1851 \caption{} 1852 \label{} 1853 \begin{tabular*}{\linewidth}{@{\extracolsep{\fill}}|p{0.2\linewidth} |p{0.5\linewidth} | p{0.15\linewidth} |} 1854 \hline 1855 \hline 1856 \end{tabular*} 1857 \end{table} 1858 829 1859 Table Parameters of the command to calculate momentum acceptance 830 1860 parameter … … 921 1951 FitTune4Flag Q1a Q1b Q2a Q2b nux nuz 922 1952 The parameters of this command are shown in Table . 1953 1954 \begin{table}[h] 1955 \centering 1956 \caption{} 1957 \label{} 1958 \begin{tabular*}{\linewidth}{@{\extracolsep{\fill}}|p{0.2\linewidth} |p{0.5\linewidth} | p{0.15\linewidth} |} 1959 \hline 1960 \hline 1961 \end{tabular*} 1962 \end{table} 1963 923 1964 Table Parameters of the command âFitTune4Flagâ. 924 1965 Parameters … … 956 1997 FitChromFlag SX1 SX2 epsilon\_x epsilon\_z 957 1998 The parameters of this command are shown in Table . 1999 2000 \begin{table}[h] 2001 \centering 2002 \caption{} 2003 \label{} 2004 \begin{tabular*}{\linewidth}{@{\extracolsep{\fill}}|p{0.2\linewidth} |p{0.5\linewidth} | p{0.15\linewidth} |} 2005 \hline 2006 \hline 2007 \end{tabular*} 2008 \end{table} 2009 958 2010 Table Parameters of the command âFitChromFlagâ. 959 2011 Parameters … … 1063 2115 1064 2116 The meanings of the above commands and the default values used to do ID compensation using quadrupoles are shown in Table . 2117 2118 \begin{table}[h] 2119 \centering 2120 \caption{} 2121 \label{} 2122 \begin{tabular*}{\linewidth}{@{\extracolsep{\fill}}|p{0.2\linewidth} |p{0.5\linewidth} | p{0.15\linewidth} |} 2123 \hline 2124 \hline 2125 \end{tabular*} 2126 \end{table} 2127 1065 2128 Table Parameters of commands to do ID compensation using quadrupoles. 1066 2129 Parameters … … 1107 2170 1108 2171 2172 2173 2174 2175 2176 2177 2178 Frequency map analysis for on momentum particle, command ``FmapFlag''. 2179 \begin{itemize} 2180 \item 2181 Frequency map analysis for off momentum particle, command ``FmapdpFlag''. 2182 \item 2183 Track momentum acceptance at lattice elements, command ``MomentumAccFlag''. 2184 \end{itemize} 2185 2186 \subsection{Compile} 2187 The commonly used compilers for parallel computation are MPI 2, and Intel MPI which is based on MPI 2. For the cluster of SOLEIL Synchrotron, Intel MPI is installed. To get the parallel Tracy work, three files of the non-parallel version Tracy need to be modified. 2188 The details are shown in the following steps. 2189 \begin{enumerate} 2190 \item 2191 The path of included files of Intel MPI is added in ``Makefile.am'' under 2192 path ``\$HOME/TracyIII/tracy/tracy/src'' (shown in BLUE color): 2193 2194 INCLUDES = -I../inc -I\$(NUM\_REC)/inc 2195 -I/opt/intel/impi/3.2.2.006/include64 2196 \item 2197 The execute file, source file, paths of included files and library of Intel 2198 MPI are modified in ``Makefile.am'' under path ``\$HOME/TracyIII/tracy/tools'' 2199 (shown in BLUE color): 2200 2201 bin\_PROGRAMS = psoltracy 2202 2203 soltracy\_SOURCES = soltracy.cc nrutil.c nrcheck.c 2204 nrlinwww.c nrframe.c ../tracy/src/tracy\_lib.cc -> 2205 psoltracy\_SOURCES = psoltracy.cc nrutil.c nrcheck.c 2206 nrlinwww.c nrframe.c ../tracy/src/tracy\_lib.cc 2207 2208 LIBS = -L\$(NUM\_REC)/lib 2209 -L/opt/intel/impi/3.2.2.006/lib64 -L\$(LIBPATH) 2210 -lrecipes\_c\_icc -lstdc++ -lgfortran -lmpichcxx 2211 2212 INCLUDES = -I\$(TRACY\_LIB)/tracy/inc -I\$(NUM\_REC)/inc 2213 -I/opt/intel/impi/3.2.2.006/include64 2214 \item 2215 The compilers used in the parallel computing are defined in the ``make\_for\_psoltracy.sh'' located in path ``\$HOME/TracyIII'' as (shown in BLUE color): 2216 2217 CC = mpiicc 2218 2219 CXX = mpiicpc 2220 2221 F77 = mpiifort 2222 2223 Depending on the compilers used to do parallel computation, user needs to 2224 update the compilers in ``make\_for\_psoltracy.sh'' and the paths of included 2225 files and library which are shown above with blue color. 2226 2227 After updating compilers, paths of included files and library for parallel 2228 computation, user can run 2229 2230 make\_for\_psoltracy.sh 2231 2232 under the shell script to compile the parallel Tracy. After compilation, 2233 the execute file ``psoltracy'' is automatically generated under the 2234 path ``\$HOME/TracyIII/tracy/tools''. 2235 2236 2237 \end{enumerate} 2238 2239 \subsection{Run} 2240 As the non-parallel version Tracy, user needs to write the commands in a script which must be with the file extension â.prmâ. The syntaxes to define the script â*.prmâ are the same for both non-parallel and parallel Tracy. 2241 To run the parallel Tracy, user need to contact the administrator of their cluster to know how to run parallel programs on the cluster. For the cluster on Synchrotron SOLEIL, the nodes used to do parallel computation are assigned by PBS (Portable Batch System), so a script is need. For example, user define the input script âtest.prmâ to tell Tracy what jobs are need to be done on the cluster, define script âlance\_tracy3\_parallel.shâ to assign the numbers of CPUs to do parallel computation and lance job to the SOLEIL cluster. and then type the following command under the bash shell to submit the job and run the parallel Tracy on the cluster: 2242 2243 lance\_tracy3\_parallel.sh test.prm 2244 2245 \section{ User input script} 2246 There are two types of keywords in the user input script. The first type is to set the file, the file names, and define parameters for the related calculations; the key words for such definitions are ended with the characters âFlagâ. The second type is to define Boolean commands with or without parameters to do different calculations. The rules of the definition of input scripts are: 2247 The blank lines and lines starting with "\#" (comment line) are ignored by the code. 2248 Keywords without âFlagâ as the final 4 characters are NOT executed according to the defined sequence in user input script. If the same command keywords are defined many times in the user script, only the last defined keyword is executed. 2249 The commands with the last 4 characters as âFlagâ are executed according to the sequence in the code. 2250 The definition of lattice file at the beginning of the user script is mandatory. If the lattice file is with any of the following elements: horizontal correctors, vertical correctors, girders, BPM, skew quadrupoles, user must declare the element name at the beginning of input script. 2251 One keyword command uses one line. User can not define more than one command at the same line. 2252 Except explanation, all commands with Boolean flag are the generic commands, and can be used on all the lattice of the ring. 2253 \subsection{ File path} 2254 In the user input script, user can specify the name of the files which are used in the calculation, such as the lattice file, multipole field error file, misalignment error file, vacuum chamber file. When specifying the file name, user can provide the absolute path for the file which is not located at the current path, such as: â/home/physmach/Tracy3/tracy/soleil.latâ; or for convenience, user provides the filename without absolute path, but put the files at a certain directory and then specific this directory using the command: 2255 in\_dir user\_defined\_path 2256 For example: 2257 in\_dir /home/zhang/codes/TracyIII/lattice/ 2258 2259 This command tells the code all the files specified in the script are located at the directory â/home/zhang/codes/TracyIII/lattice/â. If user declares the files without absolute path and does not set the directory through command in\_dir; or the files specified in the script are not found at the current working path, the code will give an error message and stop running. 2260 2261 \section{ File names} 2262 2263 \subsection{Lattice file name} 2264 In the input script, user must define the lattice name, this is mandatory. The command is: 2265 lat\_file lattice\_file\_name 2266 Here âlattice\_file\_nameâ is the lattice file name without â.latâ extension. For example, the following command sets the lattice file of SOLEIL ring: 2267 lat\_file solamor2\_reglage\_focalisation\_chcvqt\_thicksextu\_LQPintermediaire\_QFF 2268 In Tracy 3, after reading the lattice, Twiss parameters are automatically printed to the file âlinlat.outâ. 2269 If one of these elements (Horizontal/vertical correctors or beam position monitors, or girders, or skew quadrupoles.) are defined in the lattice file, for example to read the misalignment errors of the lattice element and then do orbit correction, to read multipole field errors (SOLEIL lattice), etc.; user MUST specify the names of these elements using the corresponding commands in the â*.prmâ script: 2270 h\_corr HCM 2271 v\_corr VCM 2272 gs GS 2273 ge GE 2274 bpm\_name BPM 2275 qt QT 2276 Here âHCMâ is the name of horizontal correctors used for horizontal orbit correction, or the horizontal correctors on which the multipole field errors are added in SOLEIL lattice; âVCMâ is the name of vertical correctors used for vertical orbit correction, or the vertical correctors on which the multipole field errors are added in SOLEIL lattice; âGSâ is the name of the start girder; âGEâ is the name of the end girder; âBPMâ is the name of beam position monitors defined in the lattice file; âQTâ is the name of the skew quadrupoles defined in the lattice. Generally, user needs to define horizontal, vertical correctors and BPMs when reading the misalignment errors or correcting closed orbit distortion 2277 2278 \subsection{Multipole field error file name (SOLEIL lattice)} 2279 User can read the multipole field errors on SOLEIL lattice from an external file; the file is specified in the user script using the following command: 2280 multipole\_file multipole\_file\_name 2281 Here âmultipole\_file\_nameâ is the user defined multipole field error file, the format of this file is given in section Error: Reference source not found. 2282 2283 If the multipole field errors of horizontal, vertical correctors and skew quadrupoles are defined in the âmultipole\_fileâ, user MUST specify the names of these lattice elements in the â*.prmâ file as the following example: 2284 h\_corr CH 2285 v\_corr CV 2286 qt QT 2287 Here âCHâ, âCVâ and âQTâ are the names of horizontal, vertical correctors, and skew quadrupoles respectively which are defined in the lattice file. 2288 2289 \subsection{Files of multipole field errors of correctors and skew quadrupoles (SOLEIL lattice)} 2290 Horizontal, vertical correctors and skew quadrupoles are integrated with the sextupole quadrupoles on SOLEIL storage ring. To define the multipole field errors on these elements, user need to define the orders and relative strengths of multipole field errors in the multipole field error file (section Error: Reference source not found) and specify the file name in the user input script â*.prmâ (section Multipole field error file name), then specify the file names as the following example: 2291 fic\_hcorr corh.txt 2292 fic\_vcorr corv.txt 2293 fic\_skew corqt.txt 2294 Here âcorh.txtâ and âcorv.txtâ are the files with measured current values corh, corv, corqt (with unit [Ampere]) for the horizontal, vertical correctors and skew quadrupoles respectively. Based on the measured current values, user can get the integrated field strength as: 2295 Hcorr\_strength [T.m] = corh *\_convHcorr /brho; (horizontal correctors) 2296 Vcorr\_strength [T.m] = corv *\_convVcorr /brho; (vertical correctors) 2297 Qt\_strength [T.m] = corqt *\_convQt /brho; (skew quadrupoles) 2298 here brho is the momentum rigidity, and the conversion constants between current and field are \_convHcorr = 8.14e-4, \_convVcorr = 4.642e-4, \_convQt = 93.83e-4. 2299 For SOLEIL lattice, the SAME ORDER of multipole field errors on the same elements are added together, so the SAME ORDER of horizontal/vertical, skew quadrupoles, and sextupoles are added together since these elements are integrated at the same magnets. 2300 2301 \subsection{ File to define field strength of virtual coupling source elements (SOLEIL lattice)} 2302 On SOLEIL storage ring, the coupling is thought to come from the rotation of quadrupoles and vertical displacements of sextupoles. The strengths of these coupling sources are written in a file, then read by the following command: 2303 virtualskewquad\_file virtual\_skew\_quad\_currents.txt 2304 2305 Here âvirtual\_skew\_quad\_currents.txtâ is the user defined file with strength of vertical coupling source. 2306 In order to use this command to read the virtual sources of coupling, user needs to define the virtual coupling element as a skew quadrupole in the lattice file: 2307 SQ: quadrupole, tilt=45.0, K= 0.0, method=4, N=1; 2308 and this virtual coupling element MUST be with the name âSQâ. Now there 152 elements defined as the virtual coupling sources in the SOLEIL lattice. The syntaxs to define skew quadrupole are explained in section . 2309 The measured current value qtcorr[i] of the ith coupling source is converted to the corresponding integrated skew quadrupole field strength corr\_strength as 2310 corr\_strength [m-1] = qtcorr[i]*conv/brho; 2311 here brho is momentum rigidity, and the conversion constant conv is 93.88e-4 [A-1.T]. 2312 2313 \subsection{Cut off value} 2314 Set the cut off value of all random distribution (Gaussian distribution) to ânâ times of the RMS value sigma: 2315 normalcut n 2316 2317 \section{Physics: Hamiltionian} 2318 The dynamic motion of a conserved system can be described by a Hamiltonian. For an accelerator system without radiation 2319 damping (energy loss) and RF cavities (energy gain), the motion of a single electron in the magnetic field can be described using the 2320 following Hamitonian in the curvilinear coordinate system (Merz...) 2321 \begin{eqnarray} 2322 H (x,P_x; y, P_y; -t, \delta; s) &=& L + V \\ 2323 &=& -(1+h_{\mathrm{ref}}x)[\sqrt(P^2 - (P_x - eA_x)^2 - (P_y - eA_y)^2 ) + eA_z(x,P_x; y, P_y,s)] \\ 2324 P^2 & =& P_x^2 + P_y^2 + P_z^2 2325 \end{eqnarray} 2326 $h_{\mathrm{ref}}$ is the curvature of reference orbit inside the dipole. 2327 The $(x,P_x; y, P_y; -t, \delta)$ are the canonical cooridinates of the $H$, and $P_x, P_y, P-z$ are respectively the 2328 horizontal, vertical, and longitudinal mechanical momentums. A more convienent way is to expand the electron motion 2329 around the motion of a reference particle with total momentum $P_0$, so 2330 \begin{eqnarray} 2331 \frac{1}{P_0}H (x,P_x; y, P_y; -t, \delta; s) &=& \\ 2332 H (x,p_x; y, p_y; -t, \delta; s) &=& -(1+h_{\mathrm{ref}}x)\sqrt((1+\delta)^2 - (p_x - \frac{e}{P_0}A_x)^2 - (p_y - \frac{e}{P_0}A_y)^2 ) + \frac{e}{P_0}A_z(x,p_x; y, p_y,s) \\ 2333 &=& -(1+h_{\mathrm{ref}}x)\sqrt((1+\delta)^2 - (p_x - \frac{1}{B \rho}A_x)^2 - (p_y - \frac{1}{B \rho}A_y)^2 ) + \frac{1}{B \rho}A_z(x,p_x; y, p_y,s) 2334 \end{eqnarray} 2335 with 2336 \begin{eqnarray} 2337 p_x &=& \frac{P_x}{P_0} \\ 2338 p_y &=& \frac{P_y}{P_0} \\ 2339 p &=& \frac{P}{P_0} = \frac{\Delta P + P_0}{P_0} = (1+\delta) \\ 2340 \delta &=& \frac{\Delta P}{P_0} \\ 2341 B \rho &=& \frac{P_0}{e} (magnetic rigidity) 2342 \end{eqnarray} 2343 2344 With some operations (J. Bengtsson's linear transverse dynamics for sotrage ring with applications to the low energy antiproton ring (LEAR) at CERN; Tracy 2 manual.), 2345 the Hamitonian can be expressed with the canonical coordinates $(x,p_x; y, p_y; -ct, \delta; s)$ (Tracy-2 Manual, J. Bengtsson) 2346 2347 \begin{align*} 2348 %\label{Tracy:Exact:H} 2349 H (x,p_x; y, p_y; -ct, \delta; s) \\ 2350 &=-(1+h_{\mathrm{ref}}x)(\sqrt{(1+\delta)^2 - (p_x - \frac{A_x}{B \rho})^2 - (p_y - \frac{A_y}{B \rho})^2} + \frac{A_z}{B \rho}) + \delta \\ 2351 &= -(1+h_{\mathrm{ref}}x)(\sqrt{(1+\delta)^2 - (p_x - \frac{A_x}{B \rho})^2 - (p_y - \frac{A_y}{B \rho})^2 }) + h_{\mathrm{ref}} x \frac{A_z}{B \rho} \\ 2352 & + \frac{A_z}{B \rho} + \delta \\ 2353 &= \underbrace{-(1+h_{\mathrm{ref}}x)\sqrt{(1+\delta)^2 - (p_x - \frac{A_x}{B \rho})^2 - (p_y - \frac{A_y}{B \rho})^2 )}}_\text{kinetic energy} \\ 2354 & + \underbrace{\frac{x}{\rho} +\frac{x}{2\rho^2}}_\text{Gemometic components due to the curvilinear coordinate inside the dipole}\\ 2355 & +\underbrace{\frac{A_z}{B \rho}}_\text{magnet contribution} \\ 2356 & +\underbrace{\delta}_\text{due to the canonical coordinate $-ct$ instead of $-t$}\\ 2357 A_z & =A_z(x,p_x; y, p_y,s) 2358 \end{align*} 2359 2360 The equation is the exact Hamitonian used in Tracy. The $A_x$ are due to the longidutinal fringe field, this is an natural results due to the Maxwell Equation; $h_{\mathrm{ref}}$ is not zero only inside the dipoles. 2361 2362 For the system without fringe field of the magnet, or only consider the field inside the body of the magnet, $A_x = 0$ and $A_y = 0$, 2363 so the Hamiltonian is 2364 \begin{align} 2365 \label{eqn:exact:H:NoFF} 2366 H (x,p_x; y, p_y; -ct, \delta; s) \\ 2367 &= \underbrace{-(1+h_{\mathrm{ref}}x)\sqrt{(1+\delta)^2 - p_x^2 - p_y^2)}}_\text{kinetic energy} \\ 2368 & + \underbrace{\frac{x}{\rho} +\frac{x}{2\rho^2}}_\text{Gemometic components due to the curvilinear coordinate inside the dipole}\\ 2369 & +\underbrace{\frac{A_z}{B \rho}}_\text{magnet contribution} \\ 2370 & +\underbrace{\delta}_\text{due to the canonical coordinate $-ct$ instead of $-t$}\\ 2371 \end{align} 2372 2373 From eqn.~\ref{eqn:exact:H:NoFF}, it is easy to get the map of the particle inside different lattice elements. 2374 2375 2376 \subsection{Map of drift} 2377 \label{H:drift} 2378 2379 In the drift, $A_z = 0$, and $h_{\mathrm{ref}}$ = 0, from eqn.~\ref{eqn:exact:H:NoFF}, we can get the Hamiltonian 2380 inside a drift is 2381 \begin{align} 2382 \label{eqn:H:exact:drift} 2383 H (x,p_x; y, p_y; -ct, \delta; s) = -\sqrt{(1+\delta)^2 - p_x^2 - p_y^2)} + \delta 2384 \end{align} 2385 2386 In large ring, in order to increase the tracking speed, we can expand the sqare root in 2387 eqn.~\ref{eqn:H:exact:drift} to get the approximate Hamitonian. 2388 That is, 2389 \begin{align} 2390 \label{eqn:H:approxi:drift} 2391 H (x,p_x; y, p_y; -ct, \delta; s) &= -(1+\delta) \left[ 1 - \frac{p_x^2 + p_y^2}{2 (1+\delta)^2} \right] + \delta\\ 2392 &= \frac{p_x^2 + p_y^2}{2(1+\delta)} 2393 \end{align} 2394 2395 2396 From eqn.~\ref{eqn:H:exact:drift}, it is easy to get the map inside the drift for the 2397 \textbf{small ring}: 2398 \begin{align} 2399 x^{'} = \frac{dx}{ds} = \frac{\partial H}{\partial p_{x0}} = \frac{p_{x0}}{\sqrt{(1+\delta_0)^2 -(p_{x0}^2+p_{y0}^2)}} \\ 2400 y^{'} = \frac{dy}{ds} = \frac{\partial H}{\partial p_{y0}}= \frac{p_{y0}}{\sqrt{(1+\delta_0)^2 -(p_{x0}^2+p_{y0}^2)}} \\ 2401 (-ct)^{'} = \frac{d(-ct)}{ds} = \frac{\partial H}{\partial \delta_0} =-\frac{1+\delta_0}{\sqrt{(1+\delta_0)^2 -(p_{x0}^2+p_{y0}^2)}}+1 \\ 2402 or \\ 2403 (ct)^{'} = \frac{1+\delta_0}{\sqrt{(1+\delta_0)^2 -(p_{x0}^2+p_{y0}^2)}}-1 \\ 2404 p_x = p_{x0} \\ 2405 p_y = p_{y0} \\ 2406 \delta = \delta_0 2407 \end{align} 2408 2409 From eqn.~\ref{eqn:H:approxi:drift}, it is easy to get the map inside the drift for the 2410 \textbf{big ring}: 2411 \begin{align} 2412 x^{'} = \frac{dx}{ds} = \frac{\partial H}{\partial p_{x0}} = \frac{p_{x0}}{1+\delta_0} \\ 2413 y^{'} = \frac{dy}{ds} = \frac{\partial H}{\partial p_{y0}}= \frac{p_{y0}}{1+\delta_0} \\ 2414 (-ct)^{'} = \frac{d(-ct)}{ds} = \frac{\partial H}{\partial \delta_0} =-\frac{p_{x0^2}+p_{y0}^2}{2(1+\delta_0)} \\ 2415 or \\ 2416 (ct)^{'} = \frac{p_{x0^2}+p_{y0}^2}{2(1+\delta_0)} \\ 2417 p_x = p_{x0} \\ 2418 p_y = p_{y0} \\ 2419 \delta = \delta_0 2420 \end{align} 2421 2422 \subsection{Map of mutipoles} 2423 From eqn.~\ref{eqn:exact:H:NoFF}, we can get the Hamiltonian 2424 inside a multipole without fringe field is 2425 \begin{align} 2426 \label{eqn:H:exact} 2427 H (x,p_x; y, p_y; -ct, \delta; s) \\ 2428 =& \underbrace{-\sqrt{(1+\delta)^2 - p_x^2 - p_y^2}+\delta}_\text{H drift} \\ 2429 & \underbrace{-h_{\mathrm{ref}}x \sqrt{(1+\delta)^2 - p_x^2 - p_y^2}}_\text{H kick} \\ 2430 & + \underbrace{\frac{x}{\rho} +\frac{x}{2\rho^2}-\frac{A_z}{B \rho}}_\text{H kick} 2431 \end{align} 2432 2433 In eqn.~\ref{eqn:H:exact}, the Hamiltonian is decomposed into two part, one is the Hamiltonian 2434 of the drift which is due to the kinetic energy of the system (section~\ref{H:drift}), another part is the kick 2435 due to the multipoles which will give the kick to the particle. 2436 Now we only need to focus on the Hamiltonian of the multipoles which induces the kick map: 2437 \begin{align} 2438 \label{eqn:H:exact:multipole} 2439 H (x,p_x; y, p_y; -ct, \delta; s) \\ 2440 &=-h_{\mathrm{ref}}x \sqrt{(1+\delta)^2 - p_x^2 - p_y^2} \\ 2441 & +\frac{x}{\rho} +\frac{x}{2\rho^2}-\frac{A_z}{B \rho} 2442 \end{align} 2443 2444 Similarly, by expand the sqare root in eqn.~\ref{eqn:H:exact}, we can get the approximate Hamiltonian 2445 of the multipole as 2446 \begin{align} 2447 \label{eqn:H:approxi:multipole} 2448 H (x,p_x; y, p_y; -ct, \delta; s) \\ 2449 &=-h_{\mathrm{ref}}x \sqrt{(1+\delta)^2 - p_x^2 - p_y^2} \\ 2450 & +\frac{x}{\rho} +\frac{x}{2\rho^2}-\frac{A_z}{B \rho} \\ 2451 &=-h_{\mathrm{ref}} x \delta + \frac{1}{2}h_{\mathrm{ref}} h_{B} x^2 - \frac{A_z}{B \rho}+(h_B - h_{\mathrm{ref}})x 2452 \end{align} 2453 where $h_{\mathrm{ref}}$ is the curvature due to the curlininear coordinates inside the dipole, 2454 $h_{\mathrm{ref}} = 1/\rho_{ref}$; 2455 $h_{\mathrm{bend}}$ is due to the bending curvature of the dipole which is determined by the dipole 2456 field, $h_{\mathrm{bend}} = 1/ \rho_{bend}$. $h_{\mathrm{ref}} \neq 0$ only inside dipoles. 2457 2458 In the dipole, $A_z \neq 0$, and $h_{\mathrm{ref}} \neq $ 0, so 2459 from eqn.~\ref{eqn:H:exact:multipole}, we can get the kick map due to the dipole 2460 in the \textbf{small ring} which use the exact Hamiltonian: 2461 \begin{align} 2462 \label{eqn:kickmap:exact} 2463 x^{'} = \frac{dx}{ds} = \frac{\partial H}{\partial p_{x0}} = h_{\mathrm{ref}} x_0 \frac{p_{x0}}{\sqrt{(1+\delta_0)^2 -(p_{x0}^2+p_{y0}^2)}} \\ 2464 y^{'} = \frac{dy}{ds} = \frac{\partial H}{\partial p_{y0}}= h_{\mathrm{ref}} x_0 \frac{p_{y0}}{\sqrt{(1+\delta_0)^2 -(p_{x0}^2+p_{y0}^2)}} \\ 2465 p_x^{'} = -\frac{\partial H}{\partial y_0} = h_{\mathrm{ref}} \sqrt{(1+\delta_0)^2 - p_{x0}^2 - p_{y0}^2} - h_{\mathrm{bend}} - h_{\mathrm{ref}}h_{\mathrm{bend}}x - \frac{B_y}{B \rho}\\ 2466 p_y^{'} = -\frac{\partial H}{\partial y_0} = \frac{1}{B \rho} \frac{\partial A_z}{\partial y_0} = \frac{B_x}{B \rho}\\ 2467 (-ct)^{'} = \frac{d(-ct)}{ds} = \frac{\partial H}{\partial \delta_0} =-h_{\mathrm{ref}} x_0 \frac{1+\delta_0}{\sqrt{(1+\delta_0)^2 -(p_{x0}^2+p_{y0}^2)}} \\ 2468 or \\ 2469 (ct)^{'} = h_{\mathrm{ref}} x_0 \frac{1+\delta_0}{\sqrt{(1+\delta_0)^2 -(p_{x0}^2+p_{y0}^2)}} \\ 2470 \delta = \delta_0 \\ 2471 B \rho = \frac{p_0}{e} 2472 \end{align} 2473 where 2474 \begin{align} 2475 \frac{\partial A_z}{\partial x} = - B_y \\ 2476 \frac{\partial A_z}{\partial y} = B_x 2477 \end{align} 2478 since 2479 \begin{align} 2480 A_x = 0 \\ 2481 A_y =0 2482 \end{align} 2483 inside the body of the multipoles, and 2484 \begin{align*} 2485 \vec{B} = \Delta \times \vec{A} \\ 2486 \hat{x} & \hat{y} & \hat{z} \\ 2487 \frac{\partial}{x} & \frac{\partial}{y} & \frac{\partial}{z} \\ 2488 A_x & A_y & A_z \\ 2489 \end{align*} 2490 2491 2492 In the dipole, $A_z \neq 0$, and $h_{\mathrm{ref}} \neq $ 0, so 2493 from eqn.~\ref{eqn:H:approxi:multipole}, we can get the kick map due to the dipole 2494 in the \textbf{big ring} which use the exact Hamiltonian: 2495 \begin{align} 2496 \label{eqn:kickmap:approxi} 2497 x^{'} = \frac{dx}{ds} = \frac{\partial H}{\partial p_{x0}} = h_{\mathrm{ref}} x_0 \frac{p_{x0}}{1+\delta_0} \\ 2498 y^{'} = \frac{dy}{ds} = \frac{\partial H}{\partial p_{y0}}= h_{\mathrm{ref}} x_0 \frac{p_{y0}}{1+\delta_0} \\ 2499 p_x^{'} = -\frac{\partial H}{\partial y_0} = h_{\mathrm{ref}} \delta_0 - (h_{\mathrm{bend}} - h_{\mathrm{ref}}) - h_{\mathrm{ref}}h_{\mathrm{bend}}x - \frac{B_y}{B \rho}\\ 2500 p_y^{'} = -\frac{\partial H}{\partial y_0} = \frac{1}{B \rho} \frac{\partial A_z}{\partial y_0} = \frac{B_x}{B \rho}\\ 2501 (-ct)^{'} = \frac{d(-ct)}{ds} = \frac{\partial H}{\partial \delta_0} =\frac{-h_{\mathrm{ref}} x_0}{1+\delta_0} \frac{-(p_{x0}^2+p_{y0}^2)}{2(1+\delta_0)} \\ 2502 or \\ 2503 (ct)^{'} =-\frac{h_{\mathrm{ref}} x_0}{1+\delta_0} \frac{(p_{x0}^2+p_{y0}^2)}{2(1+\delta_0)} \\ 2504 \delta^{'} = 0 2505 \end{align} 2506 2507 For other multipoles (quadrupoles, sextupole, decapole, octupole, etc), the curvilinear coordinate is 2508 the cartesian coordinates, that is $h_{ref}$ = 0, so from eqn.~\ref{eqn:kickmap:exact}, the kick map for 2509 these multipoles in the small ring is: 2510 \begin{align} 2511 \label{eqn:kickmap:exact:multipole} 2512 x^{'} = \frac{dx}{ds} = \frac{\partial H}{\partial p_{x0}} = 0 \\ 2513 y^{'} = \frac{dy}{ds} = \frac{\partial H}{\partial p_{y0}}= 0 \\ 2514 p_x^{'} = -\frac{\partial H}{\partial y_0} = - (h_{\mathrm{bend}} + \frac{B_y}{B \rho})\\ 2515 p_y^{'} = -\frac{\partial H}{\partial y_0} = \frac{1}{B \rho} \frac{\partial A_z}{\partial y_0} = \frac{B_x}{B \rho}\\ 2516 (-ct)^{'} = \frac{d(-ct)}{ds} = \frac{\partial H}{\partial \delta_0} = 0\\ 2517 or \\ 2518 (ct)^{'} = 0 \\ 2519 \delta^{'} = 0 2520 \end{align} 2521 2522 With $h_{ref} = 0$, from eqn:~\ref{eqn:kickmap:approxi}, the kick map for these 2523 multipoles (quadrupoles, sextupole, decapole, octupole, etc) in the big ring is: 2524 \begin{align} 2525 \label{eqn:kickmap:approxi:multipole} 2526 x^{'} = \frac{dx}{ds} = \frac{\partial H}{\partial p_{x0}} = 0 \\ 2527 y^{'} = \frac{dy}{ds} = \frac{\partial H}{\partial p_{y0}}= 0 \\ 2528 p_x^{'} = -\frac{\partial H}{\partial y_0} = - (h_{\mathrm{bend}} + \frac{B_y}{B \rho})\\ 2529 p_y^{'} = -\frac{\partial H}{\partial y_0} = \frac{1}{B \rho} \frac{\partial A_z}{\partial y_0} = \frac{B_x}{B \rho}\\ 2530 (-ct)^{'} = \frac{d(-ct)}{ds} = \frac{\partial H}{\partial \delta_0} = 0\\ 2531 or \\ 2532 (ct)^{'} = 0 \\ 2533 \delta^{'} = 0 2534 \end{align} 2535 2536 From the eqn~\ref{eqn:kickmap:exact} to eqn.~\ref{eqn:kickmap:approxi:multipole}, it's clear 2537 that the kick map from the main body of dipoles are different in the small ring and big ring; 2538 while the kick map from the main body of other type of multipoles are the same in small 2539 rings and big rings. 2540 2541 2542 2543 2544 2545 2546 2547 2548 \section{Magnetic field} 2549 2550 A. Dragt ....(Lie methods for acceleator........) 2551 2552 \section{FF of dipole} 2553 \subsection{kick map} 2554 E. Forest ........... 2555 2556 \section{FF of quadrupole} 2557 \subsection{kick map} 2558 2559 1109 2560 \section{ Lattice file} 2561 In the lattice, RF cavity must be defined!!! Otherwise Tracy will give the error message: 2562 \textcolor{red}{Elem\_GetPos: there are no kids in family 0 ()}. This obigatory is for the 2563 correct calculation of positive/negtive momentum compaction factor. 2564 2565 2566 1110 2567 The followings are the rules to define a lattice file used in Tracy 3. The curvelinear coordinates are 1111 2568 used. \textbf{The ideal particle or design particle sees the perfect magnetic field in all magnets, and its} … … 1182 2639 CODeps= 1.0d-15; 1183 2640 These definitions are mandatory. 1184 1185 \subsection{drift}1186 To define a drift element, the format is:1187 Symbol: drift , L = length ;1188 âSymbolâ is the user defined element name, âdriftâ is a keyword to denote this element is a drift, and using keyword âLâ, user can define the drift length of the element with unit [m].1189 For example:1190 SD1a : drift, L= 0.900000;1191 The definition of the length of the drift element is mandatory.1192 1193 \subsection{bending}1194 The bending magnet in Tracy is a symplectic element.1195 The independent variable $s$ inside the dipole harmitonian is the arc length,1196 so the length of the dipole is defined the curved path length of the design1197 particle inside the dipole.1198 1199 To define a bending magnet, the format is:1200 1201 Element\_name: \textbf{bending}, \textbf{L} = length, \textbf{T} = total bending angle,1202 \textbf{T1} = entrance angle, \textbf{T2}=exit angle,1203 \textbf{gap} = full gap between two poles, \textbf{edge\_effect1} = 1/0,1204 \textbf{edge\_effect2} = 1/0, \textbf{K} = quadrupole component field strength,1205 \textbf{method} = integration\_method, \textbf{N} = Number of slice;1206 1207 Here ``Element\_name'' is the user defined element name; ``bending'' is a keyword to denote1208 this element is a dipole; all the other parameters are explained in Table~\ref{tab:dipole-para}.1209 1210 \begin{table}[h]1211 \centering1212 \caption{Parameters of dipole in the lattice file.}1213 \label{tab:dipole-para}1214 \begin{tabular*}{\linewidth}{@{\extracolsep{\fill}}|p{0.2\linewidth} |p{0.5\linewidth} | p{0.15\linewidth} |}1215 \hline1216 \textbf{Symbol} & \textbf{Units} & \textbf{Parameter} \\1217 \hline1218 \textbf{L} & length which is a curved path length of1219 the design particle inside the dipole.1220 L = $\rho * \theta$, where $\rho$ is the1221 bending radius of the dipole, and $\theta$1222 is the bending angle of the dipole. & m \\1223 \hline1224 \textbf{T} & total bending angle & degree \\1225 \hline1226 \textbf{T1} & Entrance angle & degree \\1227 \hline1228 \textbf{T2} & Exit Angle & degree \\1229 \hline1230 \textbf{K} & (For combined dipoles) quadrupole field1231 strength if magnet length L not equal to 0 or1232 integrated field strength if L=0. & m1 (L!=0) /unitless (L=0) \\1233 \hline1234 \textbf{Method} & 1,2,4.1235 Symplectic integration method. The1236 value ``1'' means $1^{\mathrm{st}}$ order,1237 ``2'' means $2^{\mathrm{nd}}$ order,1238 and ``4'' means $4^{\mathrm{th}}$ order. & - \\1239 \hline1240 \textbf{Gap} & Distance between two poles of the dipole,1241 the gap size determine the fringe field.1242 If the gap size is 0, then the dipole has1243 no fringe field (\textcolor{red}{??????}). & m \\1244 \hline1245 \textbf{edge\_effect1} & 1/0.1246 ``1'' to turn on the edge focusing effect1247 and the fringe field at the entrance of1248 the dipole. ``0'' to turn off the two effects. & - \\1249 \hline1250 \textbf{edge\_effect2} & 1/0.1251 ``1'' to turn on the edge focusing effect1252 and the fringe field at the exit of1253 the dipole.1254 ``0'' to turn off the two effects. & - \\1255 \hline1256 \textbf{N} & number of slices when the dipole is treated in the code & - \\1257 \hline1258 \end{tabular*}1259 \end{table}1260 1261 For example:1262 1263 {** bending **}1264 1265 beta\_gap=37e-3;1266 1267 tracy\_gap=beta\_gap*2*0.724;1268 1269 BEND1 : \textbf{bending}, \textbf{L} = 1.05243, \textbf{T} = 11.25, \textbf{T1} = 5.5906,1270 \textbf{T2} = 5.67658, \textbf{K} = 0.00204,gap=tracy\_gap,1271 \textbf{edge\_effect1} = 1, \textbf{edge\_effect2} = 1, \textbf{N} = 4,1272 \textbf{method} = intmeth;1273 1274 The parameters of ``bending'' are optional, the default values for the missing parameters are 0,1275 and the default value for ``method'' is also 0.1276 1277 1278 Attension:1279 1280 In the lattice of ELEGANT, BETA, the dipole angles are defined with the unit [rad]. But in TRACY, the unit is [degree].1281 1282 \subsection{quadrupole}1283 To define a quadrupole element, the format is:1284 Symbol: quadrupole, L = length, tilt = tilt angle, K = field strength, FF1 = 1[0],1285 FF2=1[0], FFscaling = scaling factor of the field, method =1286 integration\_method, N=Number of slice;1287 1288 Here âSymbolâ is the user defined element name; âquadrupoleâ is a keyword to denote this element is a quadrupole or parts of a quadrupole; all the other parameters are explained in Table .1289 Table Parameters of quadrupoles in the lattice file.1290 Symbol1291 Parameter1292 Units1293 L1294 Length of the quadrupole1295 [m]1296 Tilt1297 tilt angle of the quadrupole;1298 if âtiltâ is non-zero, then the quadrupole is a skew quadruple.1299 [degree]1300 K1301 If L ï¹ 0,1302 then Gradient, .1303 If L= 0,1304 integrated field strength of this quadrupole component.1305 [m-2] (If L ï¹ 0)1306 1307 1308 1309 [m-1] (If L = 0)1310 FF11311 1 or 0.1312 1 means taking into account the fringe field at the left edge.1313 0 means not taking into account the fringe field at the left edge(user should notice, in order to take into account the fringe field of the quadrupoles, user also need to use âQuadFringeOnFlagâ in the user input script)1314 1315 -1316 FF21317 1 or 0.1318 1 means taking into account the fringe field at the right edge.1319 0 means not taking into account the fringe field at the right edge(user should notice, in order to take into account the quadrupole fringe field, user need also to set âQuadFringeOnFlagâ in the user input script)1320 1321 -1322 Method1323 Order of symplectic integration method.1324 Value â1â means 1st order, â2â means 2nd order, and â4â means 4th order.1325 1,2,41326 N1327 Pieces of the quadrupole to be cut when it is treated in the code.1328 -1329 1330 Example:1331 {** Quadrupole **}1332 Nq=8/2; {Number of slices}1333 dgsurg=1.00;1334 dgsurgL=1.00;1335 quadfringe=1.0;1336 LQC=0.3602;1337 1338 QP1a: quadrupole, L=LQC/2, K= -1.073038*dgsurg, FF1=quadfringe, FF2=0,1339 FFscaling =1, method=intmeth, N=Nq;1340 The parameters of âquadrupoleâ are optional, the default value for âmethodâ is 4, the default value for âFFscalingâ is 1, the default value for the other parameters are 0.1341 5.1.9 Skew quadrupole1342 The skew quadrupole is a special type of quadrupole, with a non-zero tilt angle. For example:1343 QT: quadrupole, tilt=45.0, K= 0.0, method=intmeth, N=1;1344 Notice:1345 For lattice with skew quadrupoles,1346 User must specify the name of skew quadrupole in the input file â*.prmâ with the commands:1347 qt skewquad1348 Here âskewquadâ is the name of the skew quadrupoles defined in the lattice.1349 1350 \subsection{sextupole}1351 To define one sextupole, the format is:1352 1353 Symbol: sextupole, L = length, K = field strength, FF1 = 1/0, FF2=1/0,1354 method = integration\_method, N=Number of slice;1355 Here âsymbolâ is the user defined element name; âsextupoleâ is a keyword to denote this element is a sextupole; all other parameters are explained in Table .1356 Table Parameters of sextupoles in the lattice file.1357 Symbol1358 Parameter1359 Units1360 L1361 Length of the element1362 [m]1363 K1364 If L ï¹ 0,1365 Gradient, .1366 1367 If L= 0,1368 integrated field strength with unit [m-2] of this quadrupole component.1369 [m-3] (If L ï¹ 0)1370 1371 1372 1373 [m-2] (If L = 0)1374 FF11375 1 or 0.1376 1 means taking into account the fringe field at the left edge.1377 0 means not taking into account the fringe field at the left edge1378 1379 FF21380 1 or 0.1381 1 means taking into account the fringe field at the right edge.1382 0 means not taking into account the fringe field at the right edge1383 1384 Method1385 Order of symplectic integration method.1386 Value â1â means 1st order, â2â means 2nd order, and â4â means 4th order.1387 1,2,41388 N1389 pieces of this element to be cut1390 1391 1392 For example:1393 NqSx=1; {Number of slices}1394 coef=1.0/0.16;1395 method4sextu = 4;1396 sextfringe = 0;1397 1398 SX1 : sextupole, L=0.16, K = 1.719190*coef, method=method4sextu, N = NqSx,1399 FF1=sextfringe, FF2=sextfringe;1400 The parameters of âsextupoleâ are optional, the default value for âmethodâ is 4, the default value for the other parameters is 0.1401 1402 \subsection{ multipole}1403 To define a multipole, the format is:1404 Symbol: Multipole, L= $\langle$ length $\rangle$, T =$\langle$ bending angle $\rangle$,1405 T1=$\langle$ entrance angle $\rangle$, T2=$\langle$ exit angle $\rangle$,1406 tilt=$\langle$ roll angle $\rangle$, HOM = (i, $\langle$ $b_i$ $\rangle$, $\langle$ $a_i$ $\rangle$,1407 j, $\langle$ $b_j$ $\rangle$, $\langle$ $a_j$ $\rangle$,âŠ.$n$, $\langle$ $b_n$ $\rangle$, $\langle$1408 $a_n$ $\rangle$), $N$ =$\langle$ number of slices $\rangle$, method = $\langle$ method $\rangle$;1409 Here ``symbol'' is the user defined element name; ``multipole'' is a keyword to denote1410 this element is a multipole; all other parameters are explained in Table~\ref{tab:mult-para}.1411 1412 \begin{table}[h]1413 \centering1414 \caption{Parameters of the multipoles.}1415 \label{tab:mult-para}1416 \begin{tabular*}{\linewidth}{@{\extracolsep{\fill}}|p{0.1\linewidth} |p{0.45\linewidth} | p{0.15\linewidth} | c |}1417 \hline1418 \textbf{Symbol} & \textbf{Units} & \textbf{Parameter} & \textbf{Default} \\1419 \hline1420 \textbf{L} & Length of the multipole & m & 0.0 \\1421 \hline1422 \textbf{T} & Total bending angle & degree & 0.0 \\1423 \hline1424 \textbf{T1} & Entrance angle & degree & 0.0 \\1425 \hline1426 \textbf{T2} & Exit Angle & degree & 0.0 \\1427 \hline1428 \textbf{Tilt} & Tilt angle of the1429 quadrupole; if ``tilt''1430 is non-zero, then the1431 quadrupole is a skew1432 quadruple. & degree & 0.0 \\1433 \hline1434 \textbf{HOM} & Multipole field components1435 of the element. The format1436 is \textit{n}, \textit{$b_{n}$},1437 \textit{$a_n$}, etc.1438 1439 \textit{n} is order of1440 the multipole1441 field in US. notation, n=1 means dipole errors,1442 n=2 is quadrupole errors, n=3 is sextupole field errors,1443 n=4 is octuple field errors, n=5 is decuple field errors, etc. \\1444 \textit{$b_n$} is $n^{\mathrm{th}}$1445 component of the upright multipole1446 field with the unit [$\frac{1}{m^{n}}$];1447 \textit{$a_n$} is $n^{\mathrm{th}}$ component1448 of the skew multipole field with the1449 unit [$\frac{1}{m^n}$]. & - & (0, 0.0, 0.0) \\1450 \hline1451 \textbf{N} & Pieces of this element to be cut & - & 0 \\1452 \hline1453 \textbf{Method} & 1,2,4.1454 Symplectic integration method.1455 1 is $1^{\mathrm{st}}$ order, 2 is1456 $2^{\mathrm{nd}}$ order, 4 is1457 $4\mathrm{th}$ order. & - & 0\\1458 1459 \hline1460 \end{tabular*}1461 \end{table}1462 1463 The multipole field components $a_n$ and $b_n$ are defined as1464 \begin{eqnarray}1465 b_n & = & \frac{1}{B \rho} \frac{1}{(n-1)!} \frac{\partial^{n-1} B_y }{\partial x ^{n-1}}|_{x=0,y=0} \\1466 a_n & = & \frac{1}{B \rho} \frac{1}{(n-1)!} \frac{\partial^{n-1} B_x }{\partial x ^{n-1}}|_{x=0,y=0} \\1467 B \rho & = & \frac{p_0}{e}1468 \end{eqnarray}1469 $B \rho$ is the magnetic rigidity, $p_0$ is the design beam momentum, $e$ is the electric charge.1470 1471 If the magnetic field $\vec{B^{tip}}$ is measured at the location with the radius $r_0$, then1472 $b_n$ and $a_n$ are defined as1473 \begin{eqnarray*}1474 b_n & = & \frac{1}{B \rho} \frac{B_y^{tip}}{r_0^{n-1}}\\1475 a_n & = & \frac{1}{B \rho} \frac{B_x^{tip}}{r_0^{n-1}} \\1476 \vec{B^{tip}} & = & B_y^{tip} \hat{y} + B_x^{tip} \hat{x}1477 \end{eqnarray*}1478 1479 The $n^{th}$ order magnetic field is1480 \begin{equation}1481 B_y^n + i * B_x^n = (b_n + i*a_n) * (x + i*y)^n1482 \end{equation}1483 The total magnetic field with $1^{st}$ to $n^{th}$ order field components can be calculated using1484 \begin{eqnarray}1485 \label{eqn:total:field}1486 B_y + i * B_x & = & (b_n + i*a_n) * (x+i*y)*(x + i*y)^{n-1} + O(n-1) \\1487 & = & [(b_n*x - a_n) + b_{n-1} + i*(a_n*x + b_n*y + a_{n-1})]*(x+i*y)^{n-1} + O(n-2) \\1488 & ...&1489 \end{eqnarray}1490 The eqn.~\ref{eqn:total:field} is used in Tracy3 to calculate the effective fields of the1491 magnet. This equation clearly shows that, all the field errors gives the same effect the1492 beam: horizontal focusing and vertical decusing.1493 But since the field strength of the1494 $n^{th}$ order magnet is proportial to the $n^{th}$ order of $x/y$ and $x/y$ at the1495 entrance of the magnet is small, so the higher $n$ is, the weak of the $n^{th}$ order multipole1496 field is.1497 1498 1499 Example 1:1500 1501 B: multipole, L=0.70, T=10.0, T1=5.0, T2=5.0, HOM = (1, -1.0, 0), N=8, Method=2;1502 1503 In this example, the multipole is a dipole with field component $b_1$ = -1.0, or the1504 field strength is $B_{y0}$, and the field direction is down. This field gives a horizontal1505 focusing to the electron.1506 1507 Example 2:1508 1509 QF: multipole, L=0.70, HOM = (1, 2.50, 0.0, 4, 1.01e7, 0.0), N=8, Method=4;1510 1511 In this example, the multipole is a dipole with $4^{th}$ order upright multipole filed errors (octupole),1512 and $b_4$ = 1.01e7.1513 1514 To add multipole errors in the defined lattice files, user can also define the multipoles1515 inside a separate file (Section~\ref{sec:mult:field:error}) (???? To be checked, can this routine mesured with1516 the general one???).1517 \subsection{ wiggler (To be updated.)}1518 To define a wiggler, the format is: (To be updatedâŠâŠ..)1519 symbol: Wiggler, L = $\langle$ length $\rangle$,BoBrhoV = $\langle$ B/Brho $\rangle$,BoBrhoH = $\langle$ B/Brho $\rangle$,1520 Lambda = $\langle$ period $\rangle$,kxV = $\langle$ [m] $\rangle$,kxH = $\langle$ [m] $\rangle$,phi = $\langle$ phase $\rangle$,1521 harm(n, kxV, BoBrhoV, kxH, BoBrhoH, phi), N = $\langle$ no of integration steps $\rangle$,1522 Method = $\langle$ method $\rangle$;1523 1524 Here âsymbolâ is the user defined element name; âwigglerâ is a keyword to denote this element is a wiggler; all other parameters are explained in Table .1525 Table The parameters of wigglers in a lattice file.1526 Symbol1527 Parameter1528 Units1529 L1530 Length of the wiggler1531 [m]1532 BoBrhoV1533 the normalized vertical field1534 [m-1]1535 BoBrhoH1536 the normalized horizontal field1537 [m-1]1538 Labmda1539 period length1540 [m]1541 kxV1542 1543 [m]1544 kxH1545 1546 [m]1547 phi1548 1549 [degree]1550 harm1551 1552 1553 N1554 No of integration steps1555 1556 Method1557 Symplectic integration method.1558 1 is 1st order, 2 is 2nd order, 4 is 4th order.1559 1560 1561 Example 1:1562 U143: wiggler, L=4.80, K=0.5, Lambda=0.15, N=20, Method=0;1563 1564 Example 2:1565 EPU: wiggler, L=4.80, Lambda=0.15, N=20, Method=0,1566 harm=(3, kxV\_3, BoBrhoV\_3, kxH\_3, BoBrhoH\_3, phi\_3);1567 \subsection{field map (To be updatedâŠâŠ..)}1568 To read field map from a file, use the format:1569 $\langle$ symbol $\rangle$ : Fieldmap, L = $\langle$ length [m] $\rangle$, N = $\langle$ no of integration steps $\rangle$,1570 file1 = $\langle$ file name (lower case) $\rangle$;1571 Here âsymbolâ is the user defined element name; âFieldmapâ is a keyword to denote this element is a Fieldmap; all other parameters are explained in Table .1572 Table Parameters of field map in the lattice file.1573 Symbol1574 Parameter1575 Units1576 L1577 Length of the field map1578 [m]1579 file11580 field map file1581 1582 N1583 No of integration steps1584 1585 1586 1587 âLâ is the length of the element, âNâ is the number of integration steps in the code, âfile1â is the field map file.1588 1589 Example:1590 FM: Fieldmap, L = 1.0, N = 20, file1 = "U19\_Bxyz.dat";1591 1592 \subsection{Insertion device}1593 To define the insertion device, the format is:1594 Symbol : insertion , scaling1 = 1/0, scaling2=1/0,method = interpolation\_method,1595 N=Number of slice, file1 = name of the file with 1st order radia map,1596 file2 = name of the file with 2nd order radia map;1597 Here âsymbolâ is the user defined element name; âinsertionâ is a keyword to denote this element is an insertion device; all other parameters are explained in Table .1598 Table parameters of the insertion devices in the lattice file.1599 Symbol1600 Parameter1601 Units1602 scaling11603 scaling factor for the 1st order field map1604 1605 scaling21606 scaling factor for the 2nd order map1607 1608 method1609 the order of symplectic interpolation method in the code, the value of 1 is linear interpolation, 3 is spline interpolation.1610 1611 N1612 pieces of this element is cut when it is treated in the code1613 1614 file11615 The 1st order of insertion device field are read from the files generated by RADIA.1616 If user does not specify the file name with the file path, then the code will look for the files in the current working directory. The path of the Radia map file must be in small letters, otherwise the code canât find the file.1617 1618 file11619 The 2nd order of insertion device field are read from the files generated by RADIA.1620 If user does not specify the file name with the file path, then the code will look for the files in the current working directory. The path of the Radia map file must be in small letters, otherwise the code canât find the file.1621 1622 1623 Example:1624 WIGSLIC: insertion, N = 10, scaling1=1.0, scaling2=1.0, method=2, file1="/home/sources/physmach/tracy2.7/w150g11pole60\_oppose\_radia\_pour\_tracy.txt", file2= "/home/sources/physmach/brunelle/tracy-2.7/w150g11pole20\_fin.dat";1625 1626 All the parameters for âinsertionâ is optional, the default value for scaling1 and scaling2 are 1, the default âmethodâ is 3 which means spline interpolation, the default âNâ is 1, the default values for all the other parameters are 0.1627 1628 \subsection{RF cavity}1629 To define the RF cavity, use the command:1630 Symbol: cavity, Frequency = RF frequency, Voltage = RF voltage, Phase = synchrotron1631 Phase, harnum = harmonic number of the RF cavity;1632 Here âsymbolâ is the element name, âcavityâ means that this element is a RF cavity; all the other parameters are explained in Table .1633 Table Parameters of RF cacity in the lattice file.1634 Symbol1635 Parameter1636 Units1637 frequency1638 RF frequency1639 [Hz]1640 voltage1641 RF voltage1642 [Volt]1643 phase1644 synchrotron phase1645 [degree]1646 harnum1647 harmonic number1648 -1649 1650 1651 Example:1652 CAV: Cavity, Frequency = 499.95e6, Voltage=1.22e6, phase = 30, harnum=328;1653 1654 The harmonic number of the RF cavity is mandatory, and the other parameters of âcavityâ are optional, the default values are 0.1655 1656 \subsection{corrector}1657 To define the corrector, use the command:1658 Symbol: corrector, horizontal/vertical, method = integrated method;1659 Here âsymbolâ is the element name, âcorrectorâ means that this element is a corrector; all the other parameters are explained in1660 Table parameters of correctors in the lattice file.1661 Symbol1662 Parameter1663 Units1664 Horizontal / vertical1665 âhorizontalâ means the element is a horizontal corrector; âverticalâ means the element is a vertical corrector1666 -1667 method1668 Order of symplectic integration method.1669 Value â1â means 1st order, â2â means 2nd order, and â4â means 4th order1670 1,2,41671 1672 Example:1673 {** Horizontal correctors **}1674 CH : corrector, horizontal, method=intmeth;1675 {** Vertical correctors **}1676 CV : corrector, vertical, method=intmeth;1677 1678 The parameters of âcorrectorâ are optional, the default value for âmethodâ is 0.1679 1680 Notice:1681 The âsymbolâ of correctors are special!!!!1682 For a lattice with correctors,1683 User must specify the name of corrector in the input file â*.prmâ with the commands:1684 h\_corr HCM1685 or1686 v\_corr VCM1687 Here âHCMâ is the name of the corrector defined in the lattice for horizontal orbit correction; âVCMâ is the name of the corrector defined in the lattice for vertical orbit correction.1688 1689 1690 \subsection{Marker}1691 To define a marker, use the command:1692 Symbol: marker;1693 Here âsymbolâ is the name of the element, âmarkerâ means the element is a marker in the lattice, it does not have length or field strength, etc.1694 1695 \subsection{BPM (To be updated)}1696 BPM is a special marker in the lattice; the âsymbolâ name must be âBPMâ (???). User can1697 define the BPM as:1698 BPM : type;1699 1700 Normally Its type is defined as âMarkerâ type, but in order to include the misalignment error of BPM into the lattice, it must be defined as âBeam Position Monitorâ type which is in fact multipole type, since only the element with multipole type is saved with displacement error, field error, etc.1701 1702 Notice:1703 For lattice with BPMs,1704 User must specify the name of BPM in the input file â*.prmâ with the commands:1705 bpm beaPosMonitor1706 Here âbeaPosMonitorâ is the name of the BPMs defined in the lattice.1707 1708 \subsection{Girder}1709 Girder is a special element, itâs the girder used in the real machine to support the magnetic elements and other elements. It is defined as:1710 Symbol: type;1711 1712 Normally Its type is defined as âMarkerâ type, but in order to include the misalignment error of girder into the lattice, it must be defined as âmultipoleâ type, since only the element with multipole type is saved with displacement error, field error, etc.1713 For convenience, itâs better to define the beginning of the girder and also the end of the girder, and the elements between the beginning and end of the girders are the elements who are put on the girder in the real machine.1714 1715 Notice:1716 For lattice with girders,1717 User must specify the name of girder in the input file â*.prmâ with the commands:1718 gs Girder\_Start1719 ge Girder\_End1720 1721 Here âGirder\_Startâ is the name of the start of girder defined in the lattice; âGirder\_Endâ is the name of the end of girder defined in the lattice.1722 1723 \subsection{Element block}1724 To construct the element block, use the following format:1725 Symbol: elem1, elem2,âŠ., block1,block2;1726 Here âSymbolâ is the name of the element block, and âelem1â, âelem2â, âblock1â, âblock2â are the element or sub element blocks in this element block.1727 If there are N the same element/block subsequently, user can use âN*element/blockâ to simply the definition. For example:1728 SINJ: SD1a, ssep, 3*SEP,esep,SD1c,eHU600,SD1d;1729 In this example element block, there are 9 elements/blocks, and 3 elements/blocks âSEPâ subsequently.1730 1731 \subsection{Cell}1732 User can define the cell structure using the command:1733 1734 CELL : $\langle$ block name $\rangle$, SYMMETRY=$\langle$ symmetry $\rangle$;1735 1736 $\langle$ block name $\rangle$ is the name of a block; $\langle$ symmetry $\rangle$ is the number of super symmetry or the number of the block in the ring.1737 1738 Example:1739 1740 CELL: BL1, Symmetry=12;1741 1742 This example defines the cell with block âBL1â, and the number of super symmetry is 12. The output of the Tracy3 with symmetry large than 1 will give the1743 tunes and chromaticities in one symmetric period.1744 1745 \subsection{Ring}1746 To define the ring, use the command:1747 RING: elem, blockâŠ.1748 Itâs similar to define an element block, but must with the fixed symbol name âRINGâ. For example:1749 RING: DEBUT,SUP1,SUP2,SUP3,SUP4,CAV,FIN;1750 5.1.23 End line1751 To end the lattice file, user needs to use the following command at the end of the lattice file:1752 End;1753 This command is mandatory.1754 2641 1755 2642 \section{Multipole field error file} … … 1779 2666 Bn defines the upright component of the magnetic field, then for the component of a skew quadrupole or a vertical corrector, Bn = 0 1780 2667 An defines the skew component of the magnetic field, then for the component of a dipole or upright quadrupole, An = 0. 1781 The line start with â\#â is comment line.1782 The blank line in the multipole definition file isneglected by the code.2668 The line start with â\#â is a comment line. 2669 The blank lines in the multipole definition file are neglected by the code. 1783 2670 1784 2671 There are two ways to define the multipole field errors strength, one is to define the measured field errors at the pole tip location $r_0$, 1785 then $b_n$ and $a_n$ are respectively the scale coefficient of the main magnetic field coeffeicient , for example, to define the decupole field2672 then $b_n$ and $a_n$ are respectively the scale coefficient of the main magnetic field coeffeicient. For example, to define the decupole field 1786 2673 errors inside a horizontal bending dipole with coefficient $b_1$, we define the normal scale coefficience as $c_5$ and skew scale coefficience 1787 2674 as $d_5$, then the $b_5$ component of this decupole is $c_5$ * $b_1$ and the skew coefficience $a_5$ is $d_5$ * $b_1$; that is … … 1789 2676 b_5 &=& \frac{1}{B \rho} \frac{c_5 * B_0}{r_0^5} \\ 1790 2677 a_5 &=& \frac{1}{B \rho} \frac{d_5 * B_0}{r_0^5} \\ 1791 b_1 &=& \frac{1}{B \rho} B_01792 2678 \end{eqnarray*} 1793 This method is the simplest way to define the multipole errors inside a lattice element. 2679 where 2680 \begin{equation} 2681 b_1 = \frac{1}{B \rho} B_0. 2682 \end{equation} 2683 This method is the simplest way to define the multipole errors inside a lattice element. The default scaling factors $c_n$ and $d_n$ are 1. 1794 2684 1795 2685 Another way is to direct define the multipole field coefficiences $b_n$ and $a_n$, that is, set $r_0 = 0$. … … 1915 2805 \# name x(m) y(m) r (rad) 1916 2806 \#----------------------------------------------------------------------- 2807 \begin{table}[h] 2808 \centering 2809 \caption{} 2810 \label{} 2811 \begin{tabular*}{\linewidth}{@{\extracolsep{\fill}}|p{0.2\linewidth} |p{0.5\linewidth} | p{0.15\linewidth} |} 2812 \hline 2813 \hline 2814 \end{tabular*} 2815 \end{table} 2816 1917 2817 girder sys 100.0e-6 100.0e-6 0.5e-03 1918 2818 quad sys 30.0e-6 30.0e-6 80.0e-06 … … 1932 2832 \# name x(m) y(m) r (rad) 1933 2833 \#----------------------------------------------------------------------- 2834 \begin{table}[h] 2835 \centering 2836 \caption{} 2837 \label{} 2838 \begin{tabular*}{\linewidth}{@{\extracolsep{\fill}}|p{0.2\linewidth} |p{0.5\linewidth} | p{0.15\linewidth} |} 2839 \hline 2840 \hline 2841 \end{tabular*} 2842 \end{table} 2843 1934 2844 girder rms 100.0e-6 100.0e-6 0.5e-03 1935 2845 quad rms 30.0e-6 30.0e-6 80.0e-06
Note: See TracChangeset
for help on using the changeset viewer.