elements.tex 89.1 KB
Newer Older
snuverink_j's avatar
snuverink_j committed
1 2 3 4 5 6 7 8 9 10
\input{header}

\chapter{Elements}
\label{chp:element}
\index{Elements|(}

\section{Element Input Format}
\label{sec:elm-format}
\index{Element!Format}
All physical elements are defined by statements of the form
snuverink_j's avatar
snuverink_j committed
11
\begin{verbatim}
snuverink_j's avatar
snuverink_j committed
12
label:keyword, attribute,..., attribute
snuverink_j's avatar
snuverink_j committed
13
\end{verbatim}
snuverink_j's avatar
snuverink_j committed
14 15 16 17 18 19
where
\begin{description}

\item[label]
  \index{Element!Label} \Newline
  Is the name to be given to the element (in the example QF),
snuverink_j's avatar
snuverink_j committed
20
  it is an {identifier} see~Section~\ref{label}.
snuverink_j's avatar
snuverink_j committed
21 22 23

\item[keyword] \Newline
  \index{Element!Keyword}
snuverink_j's avatar
snuverink_j committed
24
  Is a {keyword} see~Section~\ref{label},
snuverink_j's avatar
snuverink_j committed
25
  it is an element type keyword (in the example \texttt{QUADRUPOLE}),
snuverink_j's avatar
snuverink_j committed
26 27 28
\item[attribute]  \Newline
  \index{Element!Attribute}
  normally has the form
snuverink_j's avatar
snuverink_j committed
29
\begin{verbatim}
snuverink_j's avatar
snuverink_j committed
30
attribute-name=attribute-value
snuverink_j's avatar
snuverink_j committed
31
\end{verbatim}
snuverink_j's avatar
snuverink_j committed
32 33
\item[attribute-name]  \Newline
  selects the attribute from the list defined for the element type
snuverink_j's avatar
snuverink_j committed
34
  \texttt{keyword} (in the example \texttt{L} and \texttt{K1}).
snuverink_j's avatar
snuverink_j committed
35
  It must be an {identifier} see~Section~\ref{label}
snuverink_j's avatar
snuverink_j committed
36
\item[attribute-value] \Newline
snuverink_j's avatar
snuverink_j committed
37
  gives it a {value} see~Section~\ref{attribute}
snuverink_j's avatar
snuverink_j committed
38 39 40 41 42
  (in the example \texttt{1.8} and \texttt{0.015832}).
\end{description}
Omitted attributes are assigned a default value, normally zero.

\noindent Example:
snuverink_j's avatar
snuverink_j committed
43
\begin{verbatim}
snuverink_j's avatar
snuverink_j committed
44
QF: QUADRUPOLE, L=1.8, K1=0.015832;
snuverink_j's avatar
snuverink_j committed
45
\end{verbatim}
snuverink_j's avatar
snuverink_j committed
46 47 48 49 50 51 52 53 54



\section{Common Attributes for all Elements}
\label{sec:Element:common}
\index{Element!Common Attributes}
The following attributes are allowed on all elements:
\begin{kdescription}
\item[TYPE]
snuverink_j's avatar
snuverink_j committed
55
  A {string value} see~Section~\ref{astring}.
snuverink_j's avatar
snuverink_j committed
56 57 58
  It specifies an ``engineering type'' and can be used for element
  selection.
\item[APERTURE]
snuverink_j's avatar
snuverink_j committed
59
  A {string value} see~Section~\ref{astring} which describes
snuverink_j's avatar
snuverink_j committed
60 61 62 63 64 65 66 67 68 69
  the element aperture.
  All but the last attribute of the aperture have units of meter, the last one is optional and is a positive real number. Possible choices are
  \begin{itemize}
  \item \texttt{APERTURE}="\texttt{SQUARE}(\texttt{a,f})" has a square shape of width and height \texttt{a},
  \item \texttt{APERTURE}="\texttt{RECTANGLE}(\texttt{a,b,f})" has a rectangular shape of width \texttt{a} and height \texttt{b},
  \item \texttt{APERTURE}="\texttt{CIRCLE}(\texttt{d,f})" has a circular shape of diameter \texttt{d},
  \item \texttt{APERTURE}="\texttt{ELLIPSE}(\texttt{a,b,f})" has an elliptical shape of major \texttt{a} and minor \texttt{b}.
  \end{itemize}
  The option \texttt{SQUARE}(\texttt{a,f}) is equivalent to \texttt{RECTANGLE}(\texttt{a,a,f}) and \texttt{CIRCLE}(\texttt{d,f}) is equivalent to \texttt{ELLIPSE}(\texttt{d,d,f}). The size of the exit aperture is scaled by a factor $f$. For $f < 1$ the exit aperture is smaller than the entrance aperture, for $f = 1$ they are the same and for $f > 1$ the exit aperture is bigger.

snuverink_j's avatar
snuverink_j committed
70
  Dipoles have \texttt{GAP} and \texttt{HGAP} which define an aperture and hence do not recognise \texttt{APERTURE}. The aperture of the dipoles has rectangular shape of height \texttt{GAP} and width \texttt{HGAP}. In longitudinal direction it is bent such that its center coincides with the circular segment of the reference particle when ignoring fringe fields. Between the beginning of the fringe field and the entrance face and between the exit face and the end of the exit fringe field the rectangular shape has width and height that are twice of what they are inside the dipole.
snuverink_j's avatar
snuverink_j committed
71

snuverink_j's avatar
snuverink_j committed
72
  Default aperture for all other elements is a circle of {1.0}{m}.
snuverink_j's avatar
snuverink_j committed
73 74

\item[L]
snuverink_j's avatar
snuverink_j committed
75
  The length of the element (default: {0}{m}).
snuverink_j's avatar
snuverink_j committed
76
\item[WAKEF]
snuverink_j's avatar
snuverink_j committed
77
  Attach wakefield that was defined using the \texttt{WAKE} command.
snuverink_j's avatar
snuverink_j committed
78
\item[ELEMEDGE]
snuverink_j's avatar
snuverink_j committed
79
    The edge of an element is specified in s coordinates in meters. This edge corresponds to the origin of the local coordinate system and is the physical start of the element. (Note that in general the fields will extend in front of this position.) The physical end of the element is determined by \texttt{ELEMEDGE} and its physical length. (Note again that in general the fields will extend past the physical end of the element.)
snuverink_j's avatar
snuverink_j committed
80 81 82 83 84 85 86 87 88
\item[PARTICLEMATTERINTERACTION]
  Attach a handler for particle matter interaction, see \ref{chp:partmatt}.
\item[X]
  X-component of the position of the element in the laboratory coordinate system.
\item[Y]
  Y-component of the position of the element in the laboratory coordinate system.
\item[Z]
  Z-component of the position of the element in the laboratory coordinate system.
\item[THETA]
snuverink_j's avatar
snuverink_j committed
89
  Angle of rotation of the element about the y-axis relative to the default orientation, $\mathbf{n} = \transpose{\left(0, 0, 1\right)}$.
snuverink_j's avatar
snuverink_j committed
90
\item[PHI]
snuverink_j's avatar
snuverink_j committed
91 92
  Angle of rotation of the element about the x-axis relative to the default orientation, $\mathbf{n} = \transpose{\left(0, 0, 1\right)}$ \item[PSI]
  Angle of rotation of the element about the z-axis relative to the default orientation, $\mathbf{n} = \transpose{\left(0, 0, 1\right)}$ \item[ORIGIN]
snuverink_j's avatar
snuverink_j committed
93
  3D position vector. An alternative to using \texttt{X}, \texttt{Y} and \texttt{Z} to position the element. Can't be combined with \texttt{THETA} and \texttt{PHI}. Use \texttt{ORIENTATION} instead.
snuverink_j's avatar
snuverink_j committed
94
\item[ORIENTATION]
snuverink_j's avatar
snuverink_j committed
95
  Vector of Tait-Bryan angles \ref{bib:tait-bryan}. An alternative to rotate the element instead of using \texttt{THETA}, \texttt{PHI} and \texttt{PSI}. Can't be combined with \texttt{X}, \texttt{Y} and \texttt{Z}, use \texttt{ORIGIN} instead.
snuverink_j's avatar
snuverink_j committed
96 97 98 99 100 101 102
\item[DX]
  Error on x-component of position of element. Doesn't affect the design trajectory.
\item[DY]
  Error on y-component of position of element. Doesn't affect the design trajectory.
\item[DZ]
  Error on z-component of position of element. Doesn't affect the design trajectory.
\item[DTHETA]
snuverink_j's avatar
snuverink_j committed
103
  Error on angle \texttt{THETA}. Doesn't affect the design trajectory.
snuverink_j's avatar
snuverink_j committed
104
\item[DPHI]
snuverink_j's avatar
snuverink_j committed
105
  Error on angle \texttt{PHI}. Doesn't affect the design trajectory.
snuverink_j's avatar
snuverink_j committed
106
\item[DPSI]
snuverink_j's avatar
snuverink_j committed
107
  Error on angle \texttt{PSI}. Doesn't affect the design trajectory.
snuverink_j's avatar
snuverink_j committed
108 109 110 111 112 113 114 115 116 117

\end{kdescription}

All elements can have arbitrary additional attributes which are defined in the respective section.

\clearpage

\section{Drift Spaces}
\label{sec:drift}
\index{DRIFT}
snuverink_j's avatar
snuverink_j committed
118
\begin{verbatim}
snuverink_j's avatar
snuverink_j committed
119
label:DRIFT, TYPE=string, APERTURE=string, L=real;
snuverink_j's avatar
snuverink_j committed
120
\end{verbatim}
snuverink_j's avatar
snuverink_j committed
121 122
A DRIFT space has no additional attributes.
\noindent Examples:
snuverink_j's avatar
snuverink_j committed
123
\begin{verbatim}
snuverink_j's avatar
snuverink_j committed
124 125
DR1:DRIFT, L=1.5;
DR2:DRIFT, L=DR1->L, TYPE=DRF;
snuverink_j's avatar
snuverink_j committed
126
\end{verbatim}
snuverink_j's avatar
snuverink_j committed
127 128
The length of \texttt{DR2} will always be equal to the length of \texttt{DR1}.
The reference system for a drift space is a Cartesian coordinate system
snuverink_j's avatar
snuverink_j committed
129
\ifthenelse{\boolean{ShowMap}}{see~Figure~\ref{straight}}{}.
130
This is a restricted feature: \texttt{DOPAL-cycl}. In \textit{OPAL-t} drifts are implicitly given, if no field is present.
snuverink_j's avatar
snuverink_j committed
131 132 133 134 135 136 137



\clearpage
\section{Bending Magnets}
\label{sec:bend}
\index{Bending Magnets|(}
138 139 140 141
Bending magnets refer to dipole fields that bend particle trajectories. Currently \textit{OPAL} supports three different
bend elements: \texttt{RBEND}, (valid in \textit{OPAL-t}, see Section~\ref{RBend}), \texttt{SBEND} (valid in \textit{OPAL-t}, see
Section~\ref{SBend}), \texttt{RBEND3D}, (valid in \textit{OPAL-t}, see Section~\ref{RBend3D}) and \texttt{SBEND3D} (valid in
\textit{OPAL-cycl}, see Section~\ref{SBend3D}).
snuverink_j's avatar
snuverink_j committed
142 143 144 145 146

Describing a bending magnet can be somewhat complicated as there can be many parameters to consider: bend angle,
bend radius, entrance and exit angles etc. Therefore we have divided this section into several parts:

\begin{enumerate}
147
\item Section~\ref{RBend,SBend} describe the geometry and attributes of the \textit{OPAL-t} bend
snuverink_j's avatar
snuverink_j committed
148 149
  elements \texttt{RBEND} and \texttt{SBEND}.
\item Section~\ref{RBendSBendExamp} describes how to implement an \texttt{RBEND} or \texttt{SBEND} in an
150
  \textit{OPAL-t} simulation.
snuverink_j's avatar
snuverink_j committed
151
\item Section~\ref{SBend3D} is self contained. It describes how to implement an \texttt{SBEND3D} element in
152
  an \textit{OPAL-cycl} simulation.
snuverink_j's avatar
snuverink_j committed
153 154 155 156
\end{enumerate}

\input{figures/Elements/RBend}

157
\subsection{RBend (\textit{OPAL-t})}
snuverink_j's avatar
snuverink_j committed
158 159
\label{ssec:RBend}
\index{RBEND}
snuverink_j's avatar
snuverink_j committed
160 161
An \texttt{RBEND} is a rectangular bending magnet. The key property of an \texttt{RBEND} is that is has parallel
pole faces. Figure~\ref{rbend} shows an \texttt{RBEND} with a positive bend angle and a positive entrance edge angle.
snuverink_j's avatar
snuverink_j committed
162 163 164

\begin{kdescription}
\item[L]
snuverink_j's avatar
snuverink_j committed
165
  Physical length of magnet (meters, see Figure~\ref{rbend}).
snuverink_j's avatar
snuverink_j committed
166 167 168 169 170 171 172 173 174

\item[GAP]
  Full vertical gap of the magnet (meters).

\item[HAPERT]
  Non-bend plane aperture of the magnet (meters). (Defaults to one half the bend radius.)

\item[ANGLE]
  Bend angle (radians). Field amplitude of bend will be adjusted to achieve this angle. (Note that for
snuverink_j's avatar
snuverink_j committed
175
  an \texttt{RBEND}, the bend angle must be less than $\frac{\pi}{2} + E1$, where \texttt{E1} is the entrance edge angle.)
snuverink_j's avatar
snuverink_j committed
176 177

\item[K0]
snuverink_j's avatar
snuverink_j committed
178
  Field amplitude in y direction (Tesla). If the \texttt{ANGLE} attribute is set, \texttt{K0} is ignored.
snuverink_j's avatar
snuverink_j committed
179 180

\item[K0S]
snuverink_j's avatar
snuverink_j committed
181
  Field amplitude in x direction (Tesla). If the \texttt{ANGLE} attribute is set, \texttt{K0S} is ignored.
snuverink_j's avatar
snuverink_j committed
182 183

\item[K1]
snuverink_j's avatar
snuverink_j committed
184
  Field gradient index of the magnet, $K_1=-\frac{R}{B_{y}}\frac{\partial B_y}{\partial x}$, where
185
  $R$ is the bend radius as defined in Figure~\ref{rbend}. Not supported in \texttt{DOPAL-t} any more. Superimpose a \texttt{Quadrupole} instead.
snuverink_j's avatar
snuverink_j committed
186 187

\item[E1]
snuverink_j's avatar
snuverink_j committed
188
  Entrance edge angle (radians). Figure~\ref{rbend} shows the definition of a positive entrance
snuverink_j's avatar
snuverink_j committed
189 190
  edge angle. (Note that the exit edge angle is fixed in an \texttt{RBEND} element to E2 = ANGLE
  $\text{\texttt{E2}} = \text{\texttt{ANGLE}} - \text{\texttt{E1}}$).
snuverink_j's avatar
snuverink_j committed
191 192

\item[DESIGNENERGY]
snuverink_j's avatar
snuverink_j committed
193
  Energy of the reference particle ({MeV}). The reference particle travels approximately the path shown in
snuverink_j's avatar
snuverink_j committed
194
  Figure~\ref{rbend}.
snuverink_j's avatar
snuverink_j committed
195 196 197

\item[FMAPFN]
  Name of the field map for the magnet. Currently maps of type \texttt{1DProfile1} can
snuverink_j's avatar
snuverink_j committed
198 199 200
  be used see~Section~\ref{1DProfile1}. The default option for this attribute is \texttt{FMAPN} =
  ``\texttt{1DPROFILE1-DEFAULT}'' see~Section~\ref{benddefaultfieldmapopalt}. The field map is used to
  describe the fringe fields of the magnet see~Section~\ref{1DProfile1}.
snuverink_j's avatar
snuverink_j committed
201 202 203 204

\end{kdescription}

\clearpage
205
\subsection{RBend3D (\textit{OPAL-t})}
snuverink_j's avatar
snuverink_j committed
206 207
\label{ssec:RBend3D}
\index{RBEND3D}
snuverink_j's avatar
snuverink_j committed
208 209
An \texttt{RBEND3D3D} is a rectangular bending magnet. The key property of an \texttt{RBEND3D} is that is has parallel
pole faces. Figure~\ref{rbend} shows an \texttt{RBEND3D} with a positive bend angle and a positive entrance edge angle.
snuverink_j's avatar
snuverink_j committed
210 211 212

\begin{kdescription}
\item[L]
snuverink_j's avatar
snuverink_j committed
213
  Physical length of magnet (meters, see Figure~\ref{rbend}).
snuverink_j's avatar
snuverink_j committed
214 215 216 217 218 219 220 221 222

\item[GAP]
  Full vertical gap of the magnet (meters).

\item[HAPERT]
  Non-bend plane aperture of the magnet (meters). (Defaults to one half the bend radius.)

\item[ANGLE]
  Bend angle (radians). Field amplitude of bend will be adjusted to achieve this angle. (Note that for
snuverink_j's avatar
snuverink_j committed
223
  an \texttt{RBEND3D}, the bend angle must be less than $\frac{\pi}{2} + E1$, where \texttt{E1} is the entrance edge angle.)
snuverink_j's avatar
snuverink_j committed
224 225

\item[K0]
snuverink_j's avatar
snuverink_j committed
226
  Field amplitude in y direction (Tesla). If the \texttt{ANGLE} attribute is set, \texttt{K0} is ignored.
snuverink_j's avatar
snuverink_j committed
227 228

\item[K0S]
snuverink_j's avatar
snuverink_j committed
229
  Field amplitude in x direction (Tesla). If the \texttt{ANGLE} attribute is set, \texttt{K0S} is ignored.
snuverink_j's avatar
snuverink_j committed
230 231

\item[K1]
snuverink_j's avatar
snuverink_j committed
232
  Field gradient index of the magnet, $K_1=-\frac{R}{B_{y}}\frac{\partial B_y}{\partial x}$, where
233
  $R$ is the bend radius as defined in Figure~\ref{rbend}. Not supported in \texttt{DOPAL-t} any more. Superimpose a \texttt{Quadrupole} instead.
snuverink_j's avatar
snuverink_j committed
234 235

\item[E1]
snuverink_j's avatar
snuverink_j committed
236
  Entrance edge angle (radians). Figure~\ref{rbend} shows the definition of a positive entrance
snuverink_j's avatar
snuverink_j committed
237 238
  edge angle. (Note that the exit edge angle is fixed in an \texttt{RBEND3D} element to E2 = ANGLE
  $\text{\texttt{E2}} = \text{\texttt{ANGLE}} - \text{\texttt{E1}}$).
snuverink_j's avatar
snuverink_j committed
239 240

\item[DESIGNENERGY]
snuverink_j's avatar
snuverink_j committed
241
  Energy of the reference particle ({MeV}). The reference particle travels approximately the path shown in
snuverink_j's avatar
snuverink_j committed
242
  Figure~\ref{rbend}.
snuverink_j's avatar
snuverink_j committed
243 244 245

\item[FMAPFN]
  Name of the field map for the magnet. Currently maps of type \texttt{1DProfile1} can
snuverink_j's avatar
snuverink_j committed
246 247 248
  be used see~Section~\ref{1DProfile1}. The default option for this attribute is \texttt{FMAPN} =
  ``\texttt{1DPROFILE1-DEFAULT}'' see~Section~\ref{benddefaultfieldmapopalt}. The field map is used to
  describe the fringe fields of the magnet see~Section~\ref{1DProfile1}.
snuverink_j's avatar
snuverink_j committed
249 250 251 252 253 254

\end{kdescription}
\clearpage

\input{figures/Elements/SBend}

255
\subsection{SBend (\textit{OPAL-t})}
snuverink_j's avatar
snuverink_j committed
256 257
\label{ssec:SBend}
\index{SBEND}
snuverink_j's avatar
snuverink_j committed
258 259
An \texttt{SBEND} is a sector bending magnet. An \texttt{SBEND} can have independent entrance and exit edge
angles. Figure~\ref{sbend} shows an \texttt{SBEND} with a positive bend angle, a positive entrance
snuverink_j's avatar
snuverink_j committed
260 261 262 263
edge angle, and a positive exit edge angle.

\begin{kdescription}
\item[L]
snuverink_j's avatar
snuverink_j committed
264
  Chord length of the bend reference arc in meters (see Figure~\ref{sbend}), given by:
snuverink_j's avatar
snuverink_j committed
265
  \begin{equation*}
snuverink_j's avatar
snuverink_j committed
266
    L = 2 R \sin\left(\frac{\alpha}{2}\right)
snuverink_j's avatar
snuverink_j committed
267 268 269 270 271 272 273 274 275 276 277 278 279 280 281
  \end{equation*}

\item[GAP]
  Full vertical gap of the magnet (meters).

\item[HAPERT]
  Non-bend plane aperture of the magnet (meters). (Defaults to one half the bend radius.)

\item[ANGLE]
  Bend angle (radians). Field amplitude of the bend will be adjusted to achieve this angle. (Note that practically
  speaking, bend angles greater than $\frac{3 \pi}{2}$ (270 degrees) can be problematic. Beyond this, the fringe
  fields from the entrance and exit pole faces could start to interfere, so be careful when setting up bend angles
  greater than this. An angle greater than or equal to $2 \pi$ (360 degrees) is not allowed.)

\item[K0]
snuverink_j's avatar
snuverink_j committed
282
  Field amplitude in y direction (Tesla). If the \texttt{ANGLE} attribute is set, \texttt{K0} is ignored.
snuverink_j's avatar
snuverink_j committed
283 284

\item[K0S]
snuverink_j's avatar
snuverink_j committed
285
  Field amplitude in x direction (Tesla). If the \texttt{ANGLE} attribute is set, \texttt{K0S} is ignored.
snuverink_j's avatar
snuverink_j committed
286 287

\item[K1]
snuverink_j's avatar
snuverink_j committed
288
  Field gradient index of the magnet, $K_1=-\frac{R}{B_{y}}\frac{\partial B_y}{\partial x}$, where
289
  $R$ is the bend radius as defined in Figure~\ref{sbend}. Not supported in \texttt{DOPAL-t} any more. Superimpose a \texttt{Quadrupole} instead.
snuverink_j's avatar
snuverink_j committed
290 291

\item[E1]
snuverink_j's avatar
snuverink_j committed
292
  Entrance edge angle ({rad}). Figure~\ref{sbend} shows the definition of a positive entrance
snuverink_j's avatar
snuverink_j committed
293 294 295
  edge angle.

\item[E2]
snuverink_j's avatar
snuverink_j committed
296
  Exit edge angle ({rad}). Figure~\ref{sbend} shows the definition of a positive exit edge angle.
snuverink_j's avatar
snuverink_j committed
297 298

\item[DESIGNENERGY]
snuverink_j's avatar
snuverink_j committed
299
  Energy of the bend reference particle ({MeV}). The reference particle travels approximately the path shown in
snuverink_j's avatar
snuverink_j committed
300
  Figure~\ref{sbend}.
snuverink_j's avatar
snuverink_j committed
301 302 303

\item[FMAPFN]
  Name of the field map for the magnet. Currently maps of type \texttt{1DProfile1} can
snuverink_j's avatar
snuverink_j committed
304 305 306
  be used see~Section~\ref{1DProfile1}. The default option for this attribute is \texttt{FMAPN} =
  ``\texttt{1DPROFILE1-DEFAULT}'' see~Section~\ref{benddefaultfieldmapopalt}. The field map is used to
  describe the fringe fields of the magnet see~Section~\ref{1DProfile1}.
snuverink_j's avatar
snuverink_j committed
307 308 309 310 311

\end{kdescription}

\clearpage

312
\subsection{RBend and SBend Examples (\textit{OPAL-t})}
snuverink_j's avatar
snuverink_j committed
313
\label{ssec:RBendSBendExamp}
314
Describing an \texttt{RBEND} or an \texttt{SBEND} in an \textit{OPAL-t} simulation requires effectively identical commands.
snuverink_j's avatar
snuverink_j committed
315
There are only slight differences between the two. The \texttt{L} attribute has a different definition for the two
snuverink_j's avatar
snuverink_j committed
316
types of bends see~Section~\ref{RBend,SBend}, and an \texttt{SBEND} has an additional
snuverink_j's avatar
snuverink_j committed
317
attribute \texttt{E2} that has no effect on an \texttt{RBEND}, see Section~\ref{SBend}.
snuverink_j's avatar
snuverink_j committed
318
Therefore, in this section, we will give several examples of how to implement a bend, using the
snuverink_j's avatar
snuverink_j committed
319
\texttt{RBEND} and \texttt{SBEND} commands interchangeably. The understanding is that the command formats are
snuverink_j's avatar
snuverink_j committed
320 321
essentially the same.

322
When implementing an \texttt{RBEND} or \texttt{SBEND} in an \textit{OPAL-t} simulation, it is important to note the following:
snuverink_j's avatar
snuverink_j committed
323 324

\begin{enumerate}
325
\item Internally \textit{OPAL-t} treats all bends as positive, as defined by Figure~\ref{rbend,sbend}.
snuverink_j's avatar
snuverink_j committed
326 327
      Bends in other directions within the x/y plane are accomplished by rotating a positive bend
      about its z axis.
snuverink_j's avatar
snuverink_j committed
328
\item If the \texttt{ANGLE} attribute is set to a non-zero value, the \texttt{K0} and \texttt{K0S} attributes
snuverink_j's avatar
snuverink_j committed
329
  will be ignored.
snuverink_j's avatar
snuverink_j committed
330 331
\item When using the \texttt{ANGLE} attribute to define a bend, the actual beam will be bent through
  a different angle if its mean kinetic energy doesn't correspond to the \texttt{DESIGNENERGY}.
snuverink_j's avatar
snuverink_j committed
332
\item Internally the bend geometry is setup based on the ideal reference trajectory, as shown in
snuverink_j's avatar
snuverink_j committed
333
  Figure~\ref{rbend,sbend}.\item If the default field map, ``\texttt{1DPROFILE-DEFAULT}''
snuverink_j's avatar
snuverink_j committed
334
 see~Section~\ref{benddefaultfieldmapopalt}, is used, the fringe fields will be adjusted
snuverink_j's avatar
snuverink_j committed
335 336 337 338
  so that the effective length of the real, soft edge magnet matches the ideal, hard edge bend that is
  defined by the reference trajectory.
\end{enumerate}

339
For the rest of this section, we will give several examples of how to input bends in an \textit{OPAL-t}
snuverink_j's avatar
snuverink_j committed
340
simulation. We will start with a simple example using the
snuverink_j's avatar
snuverink_j committed
341 342
\texttt{ANGLE} attribute to set the bend strength and using the default field map see~Section~\ref{benddefaultfieldmapopalt}
 for describing the magnet fringe fields see~Section~\ref{1DProfile1}:
snuverink_j's avatar
snuverink_j committed
343

snuverink_j's avatar
snuverink_j committed
344
\begin{verbatim}
snuverink_j's avatar
snuverink_j committed
345 346 347 348 349 350
Bend: RBend, ANGLE = 30.0 * Pi / 180.0,
	     FMAPFN = "1DPROFILE1-DEFAULT",
	     ELEMEDGE = 0.25,
	     DESIGNENERGY = 10.0,
	     L = 0.5,
	     GAP = 0.02;
snuverink_j's avatar
snuverink_j committed
351 352
\end{verbatim}
This is a definition of a simple \texttt{RBEND} that bends the beam in a positive direction 30 degrees (towards
snuverink_j's avatar
snuverink_j committed
353
the negative x axis as if Figure~\ref{rbend}). It has a design energy of {10}{MeV}, a length of {0.5}{m}, a
snuverink_j's avatar
snuverink_j committed
354
vertical gap of {2}{\centim} and a {0}{^{\circ}} entrance edge angle. (Therefore the exit edge angle is {30}{^{\circ}}.) We are
snuverink_j's avatar
snuverink_j committed
355
using the default, internal field map ``1DPROFILE1-DEFAULT'' see~Section~\ref{benddefaultfieldmapopalt}
356
 which describes the magnet fringe fields see~Section~\ref{1DProfile1}. When \textit{OPAL} is run, you will
snuverink_j's avatar
snuverink_j committed
357
get the following output (assuming an electron beam) for this \texttt{RBEND} definition:
snuverink_j's avatar
snuverink_j committed
358

snuverink_j's avatar
snuverink_j committed
359
\begin{verbatim}
snuverink_j's avatar
snuverink_j committed
360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382
RBend > Reference Trajectory Properties
RBend > ===============================
RBend >
RBend > Bend angle magnitude:    0.523599 rad (30 degrees)
RBend > Entrance edge angle:     0 rad (0 degrees)
RBend > Exit edge angle:         0.523599 rad (30 degrees)
RBend > Bend design radius:      1 m
RBend > Bend design energy:      1e+07 eV
RBend >
RBend > Bend Field and Rotation Properties
RBend > ==================================
RBend >
RBend > Field amplitude:         -0.0350195 T
RBend > Field index (gradient):  0 m^-1
RBend > Rotation about x axis:   0 rad (0 degrees)
RBend > Rotation about y axis:   0 rad (0 degrees)
RBend > Rotation about z axis:   0 rad (0 degrees)
RBend >
RBend > Reference Trajectory Properties Through Bend Magnet with Fringe Fields
RBend > ======================================================================
RBend >
RBend > Reference particle is bent: 0.523599 rad (30 degrees) in x plane
RBend > Reference particle is bent: 0 rad (0 degrees) in y plane
snuverink_j's avatar
snuverink_j committed
383
\end{verbatim}
snuverink_j's avatar
snuverink_j committed
384
The first section of this output gives the properties of the reference trajectory like that described in
385
Figure~\ref{rbend}. From the value of \texttt{ANGLE} and the length, \texttt{L}, of the magnet, \textit{OPAL}
snuverink_j's avatar
snuverink_j committed
386
calculates the {10}{MeV} reference particle trajectory radius, \texttt{R}. From the bend geometry and the
snuverink_j's avatar
snuverink_j committed
387
entrance angle ({0}{^{\circ}} in this case), the exit angle is calculated.
snuverink_j's avatar
snuverink_j committed
388 389 390 391 392 393

The second section gives the field amplitude of the bend and its gradient (quadrupole focusing component),
given the particle charge ($-e$ in this case so the amplitude is negative to get a positive bend direction).
Also listed is the rotation of the magnet about the various axes.

Of course, in the actual simulation the particles will not see a hard edge bend magnet, but rather a soft
snuverink_j's avatar
snuverink_j committed
394
edge magnet with fringe fields described by the \texttt{RBEND} field map file \texttt{FMAPFN} see~Section~\ref{1DProfile1}.
395
So, once the hard edge bend/reference trajectory is determined, \textit{OPAL}
snuverink_j's avatar
snuverink_j committed
396
then includes the fringe fields in the calculation. When the user chooses to use the default field map,
397
\textit{OPAL} will automatically adjust the position of the fringe fields appropriately so that the soft edge magnet
snuverink_j's avatar
snuverink_j committed
398
is equivalent to the hard edge magnet described by the reference trajectory. To check that this was done
399
properly, \textit{OPAL} integrates the reference particle through the final magnet description with the fringe fields
snuverink_j's avatar
snuverink_j committed
400 401 402 403 404 405
included. The result is shown in the final part of the output. In this case we see that the soft edge bend
does indeed bend our reference particle through the correct angle.

What is important to note from this first example, is that it is this final part of the bend output that
tells you the actual bend angle of the reference particle.

snuverink_j's avatar
snuverink_j committed
406 407
In this next example, we merely rewrite the first example, but use \texttt{K0} to set the field strength
of the \texttt{RBEND}, rather than the \texttt{ANGLE} attribute:
snuverink_j's avatar
snuverink_j committed
408

snuverink_j's avatar
snuverink_j committed
409
\begin{verbatim}
snuverink_j's avatar
snuverink_j committed
410 411 412 413 414 415
Bend: RBend, K0 = -0.0350195,
	     FMAPFN = "1DPROFILE1-DEFAULT",
	     ELEMEDGE = 0.25,
	     DESIGNENERGY = 10.0E6,
	     L = 0.5,
	     GAP = 0.02;
snuverink_j's avatar
snuverink_j committed
416
\end{verbatim}
417
The output from \textit{OPAL} now reads as follows:
snuverink_j's avatar
snuverink_j committed
418

snuverink_j's avatar
snuverink_j committed
419
\begin{verbatim}
snuverink_j's avatar
snuverink_j committed
420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442
RBend > Reference Trajectory Properties
RBend > ===============================
RBend >
RBend > Bend angle magnitude:    0.523599 rad (30 degrees)
RBend > Entrance edge angle:     0 rad (0 degrees)
RBend > Exit edge angle:         0.523599 rad (30 degrees)
RBend > Bend design radius:      0.999999 m
RBend > Bend design energy:      1e+07 eV
RBend >
RBend > Bend Field and Rotation Properties
RBend > ==================================
RBend >
RBend > Field amplitude:         -0.0350195 T
RBend > Field index (gradient):  0 m^-1
RBend > Rotation about x axis:   0 rad (0 degrees)
RBend > Rotation about y axis:   0 rad (0 degrees)
RBend > Rotation about z axis:   0 rad (0 degrees)
RBend >
RBend > Reference Trajectory Properties Through Bend Magnet with Fringe Fields
RBend > ======================================================================
RBend >
RBend > Reference particle is bent: 0.5236 rad (30.0001 degrees) in x plane
RBend > Reference particle is bent: 0 rad (0 degrees) in y plane
snuverink_j's avatar
snuverink_j committed
443
\end{verbatim}
snuverink_j's avatar
snuverink_j committed
444 445 446 447 448 449 450
The output is effectively identical, to within a small numerical error.

Now, let us modify this first example so that we bend instead in the negative x direction. There are several
ways to do this:

\begin{enumerate}
\item
snuverink_j's avatar
snuverink_j committed
451
\begin{verbatim}
snuverink_j's avatar
snuverink_j committed
452 453 454 455 456 457
Bend: RBend, ANGLE = -30.0 * Pi / 180.0,
	     FMAPFN = "1DPROFILE1-DEFAULT",
	     ELEMEDGE = 0.25,
	     DESIGNENERGY = 10.0E6,
	     L = 0.5,
	     GAP = 0.02;
snuverink_j's avatar
snuverink_j committed
458
\end{verbatim}
snuverink_j's avatar
snuverink_j committed
459
\item
snuverink_j's avatar
snuverink_j committed
460
\begin{verbatim}
snuverink_j's avatar
snuverink_j committed
461 462 463 464 465 466 467
Bend: RBend, ANGLE = 30.0 * Pi / 180.0,
	     FMAPFN = "1DPROFILE1-DEFAULT",
	     ELEMEDGE = 0.25,
	     DESIGNENERGY = 10.0E6,
	     L = 0.5,
	     GAP = 0.02,
             ROTATION = Pi;
snuverink_j's avatar
snuverink_j committed
468
\end{verbatim}
snuverink_j's avatar
snuverink_j committed
469
\item
snuverink_j's avatar
snuverink_j committed
470
\begin{verbatim}
snuverink_j's avatar
snuverink_j committed
471 472 473 474 475 476
Bend: RBend, K0 = 0.0350195,
	     FMAPFN = "1DPROFILE1-DEFAULT",
	     ELEMEDGE = 0.25,
	     DESIGNENERGY = 10.0E6,
	     L = 0.5,
	     GAP = 0.02;
snuverink_j's avatar
snuverink_j committed
477
\end{verbatim}
snuverink_j's avatar
snuverink_j committed
478
\item
snuverink_j's avatar
snuverink_j committed
479
\begin{verbatim}
snuverink_j's avatar
snuverink_j committed
480 481 482 483 484 485 486
Bend: RBend, K0 = -0.0350195,
	     FMAPFN = "1DPROFILE1-DEFAULT",
	     ELEMEDGE = 0.25,
	     DESIGNENERGY = 10.0E6,
	     L = 0.5,
	     GAP = 0.02,
             ROTATION = Pi;
snuverink_j's avatar
snuverink_j committed
487
\end{verbatim}
snuverink_j's avatar
snuverink_j committed
488 489 490
\end{enumerate}
In each of these cases, we get the following output for the bend (to within small numerical errors).

snuverink_j's avatar
snuverink_j committed
491
\begin{verbatim}
snuverink_j's avatar
snuverink_j committed
492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514
RBend > Reference Trajectory Properties
RBend > ===============================
RBend >
RBend > Bend angle magnitude:    0.523599 rad (30 degrees)
RBend > Entrance edge angle:     0 rad (0 degrees)
RBend > Exit edge angle:         0.523599 rad (30 degrees)
RBend > Bend design radius:      1 m
RBend > Bend design energy:      1e+07 eV
RBend >
RBend > Bend Field and Rotation Properties
RBend > ==================================
RBend >
RBend > Field amplitude:         -0.0350195 T
RBend > Field index (gradient):  -0 m^-1
RBend > Rotation about x axis:   0 rad (0 degrees)
RBend > Rotation about y axis:   0 rad (0 degrees)
RBend > Rotation about z axis:   3.14159 rad (180 degrees)
RBend >
RBend > Reference Trajectory Properties Through Bend Magnet with Fringe Fields
RBend > ======================================================================
RBend >
RBend > Reference particle is bent: -0.523599 rad (-30 degrees) in x plane
RBend > Reference particle is bent: 0 rad (0 degrees) in y plane
snuverink_j's avatar
snuverink_j committed
515
\end{verbatim}
snuverink_j's avatar
snuverink_j committed
516
In general, we suggest to always define a bend in the positive x
snuverink_j's avatar
snuverink_j committed
517
direction (as in Figure~\ref{rbend}) and then use the \texttt{ROTATION} attribute to bend in other
snuverink_j's avatar
snuverink_j committed
518 519
directions in the x/y plane (as in examples 2 and 4 above).

snuverink_j's avatar
snuverink_j committed
520
As a final \texttt{RBEND} example, here is a suggested format for the four bend definitions if one where implementing
snuverink_j's avatar
snuverink_j committed
521 522
a four dipole chicane:

snuverink_j's avatar
snuverink_j committed
523
\begin{verbatim}
snuverink_j's avatar
snuverink_j committed
524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558
Bend1: RBend, ANGLE = 20.0 * Pi / 180.0,
              E1 = 0.0,
	      FMAPFN = "1DPROFILE1-DEFAULT",
	      ELEMEDGE = 0.25,
	      DESIGNENERGY = 10.0E6,
	      L = 0.25,
	      GAP = 0.02,
              ROTATION = Pi;

Bend2: RBend, ANGLE = 20.0 * Pi / 180.0,
              E1 = 20.0 * Pi / 180.0,
	      FMAPFN = "1DPROFILE1-DEFAULT",
	      ELEMEDGE = 1.0,
	      DESIGNENERGY = 10.0E6,
	      L = 0.25,
	      GAP = 0.02,
              ROTATION = 0.0;

Bend3: RBend, ANGLE = 20.0 * Pi / 180.0,
              E1 = 0.0,
	      FMAPFN = "1DPROFILE1-DEFAULT",
	      ELEMEDGE = 1.5,
	      DESIGNENERGY = 10.0E6,
	      L = 0.25,
	      GAP = 0.02,
              ROTATION = 0.0;

Bend4: RBend, ANGLE = 20.0 * Pi / 180.0,
              E1 = 20.0 * Pi / 180.0
	      FMAPFN = "1DPROFILE1-DEFAULT",
	      ELEMEDGE = 2.25,
	      DESIGNENERGY = 10.0E6,
	      L = 0.25,
	      GAP = 0.02,
              ROTATION = Pi;
snuverink_j's avatar
snuverink_j committed
559
\end{verbatim}
snuverink_j's avatar
snuverink_j committed
560

snuverink_j's avatar
snuverink_j committed
561
Up to now, we have only given examples of \texttt{RBEND} definitions. If we replaced ``RBend'' in the above
562
examples with ``SBend'', we would still be defining valid \textit{OPAL-t} bends. In fact, by adjusting the \texttt{L}
snuverink_j's avatar
snuverink_j committed
563
attribute according to Section~\ref{RBend,SBend}, and by adding the appropriate
snuverink_j's avatar
snuverink_j committed
564 565
definitions of the \texttt{E2} attribute, we could even get identical results using \texttt{SBEND}s instead of
\texttt{RBEND}s. (As we said, the two bends are very similar in command format.)
snuverink_j's avatar
snuverink_j committed
566 567

Up till now, we have only used the default field map. Custom field maps can also be used. There are two
snuverink_j's avatar
snuverink_j committed
568
different options in this case see~Section~\ref{1DProfile1}:
snuverink_j's avatar
snuverink_j committed
569 570 571 572 573

\begin{enumerate}
\item Field map defines fringe fields and magnet length.
\item Field map defines fringe fields only.
\end{enumerate}
574 575
The first case describes how field maps were used in previous versions of \textit{OPAL} (and can still be used in
the current version). The second option is new to \textit{OPAL} \textit{OPAL}version{1.2.00} and it has a couple of advantages:
snuverink_j's avatar
snuverink_j committed
576 577

\begin{enumerate}
snuverink_j's avatar
snuverink_j committed
578
\item Because only the fringe fields are described, the length of the magnet must be set using the \texttt{L}
snuverink_j's avatar
snuverink_j committed
579 580 581 582 583
  attribute. In turn, this means that the same field map can be used by many bend magnets with different
  lengths (assuming they have equivalent fringe fields). By contrast, if the magnet length is set by the
  field map, one must generate a new field map for each dipole of different length even if the fringe fields are the
  same.
\item We can adjust the position of the fringe field origin relative to the entrance and exit points of the
snuverink_j's avatar
snuverink_j committed
584
  magnet see~Section~\ref{1DProfile1}. This gives us another degree
snuverink_j's avatar
snuverink_j committed
585 586 587 588 589 590 591
  of freedom for describing the fringe fields, allowing us to adjust the effective length of the magnet.
\end{enumerate}

We will now give examples of how to use a custom field map, starting with the first case where the field
map describes the fringe fields and the magnet length. Assume we have the following \texttt{1DProfile1} field
map:

snuverink_j's avatar
snuverink_j committed
592
\begin{verbatim}
snuverink_j's avatar
snuverink_j committed
593 594 595 596 597 598 599
1DProfile1 1 1 2.0
 -10.0  0.0  10.0 1
  15.0  25.0 35.0 1
  0.00000E+00
  2.00000E+00
  0.00000E+00
  2.00000E+00
snuverink_j's avatar
snuverink_j committed
600 601
\end{verbatim}
We can use this field map to define the following bend (note we are now using the \texttt{SBEND} command):
snuverink_j's avatar
snuverink_j committed
602

snuverink_j's avatar
snuverink_j committed
603
\begin{verbatim}
snuverink_j's avatar
snuverink_j committed
604 605 606 607 608 609 610
Bend: SBend, ANGLE = 60.0 * Pi / 180.0,
             E1 = -10.0 * Pi / 180.0,
             E2 = 20.0  Pi / 180.0,
	     FMAPFN = "TEST-MAP.T7",
	     ELEMEDGE = 0.25,
	     DESIGNENERGY = 10.0E6,
	     GAP = 0.02;
snuverink_j's avatar
snuverink_j committed
611 612
\end{verbatim}
\textbf{Notice that we do not set the magnet length using the \texttt{L} attribute.} (In fact, we don't even
snuverink_j's avatar
snuverink_j committed
613 614 615
include it. If we did and set it to a non-zero value, the exit fringe fields of the magnet would not be correct.)
This input gives the following output:

snuverink_j's avatar
snuverink_j committed
616
\begin{verbatim}
snuverink_j's avatar
snuverink_j committed
617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639
SBend > Reference Trajectory Properties
SBend > ===============================
SBend >
SBend > Bend angle magnitude:    1.0472 rad (60 degrees)
SBend > Entrance edge angle:     -0.174533 rad (-10 degrees)
SBend > Exit edge angle:         0.349066 rad (20 degrees)
SBend > Bend design radius:      0.25 m
SBend > Bend design energy:      1e+07 eV
SBend >
SBend > Bend Field and Rotation Properties
SBend > ==================================
SBend >
SBend > Field amplitude:         -0.140385 T
SBend > Field index (gradient):  0 m^-1
SBend > Rotation about x axis:   0 rad (0 degrees)
SBend > Rotation about y axis:   0 rad (0 degrees)
SBend > Rotation about z axis:   0 rad (0 degrees)
SBend >
SBend > Reference Trajectory Properties Through Bend Magnet with Fringe Fields
SBend > ======================================================================
SBend >
SBend > Reference particle is bent: 1.0472 rad (60 degrees) in x plane
SBend > Reference particle is bent: 0 rad (0 degrees) in y plane
snuverink_j's avatar
snuverink_j committed
640 641 642
\end{verbatim}
Because we set the bend strength using the \texttt{ANGLE} attribute, the magnet field strength is automatically
adjusted so that the reference particle is bent exactly \texttt{ANGLE} radians when the fringe fields are included.
snuverink_j's avatar
snuverink_j committed
643 644
(Lower output.)

snuverink_j's avatar
snuverink_j committed
645
Now we will illustrate the case where the magnet length is set by the \texttt{L} attribute and only the fringe
snuverink_j's avatar
snuverink_j committed
646
fields are described by the field map. We change the \textit{TEST-MAP.T7} file to:
snuverink_j's avatar
snuverink_j committed
647
\begin{verbatim}
snuverink_j's avatar
snuverink_j committed
648 649 650 651 652 653 654
1DProfile1 1 1 2.0
 -10.0  0.0  10.0 1
 -10.0  0.0  10.0 1
  0.00000E+00
  2.00000E+00
  0.00000E+00
  2.00000E+00
snuverink_j's avatar
snuverink_j committed
655
\end{verbatim}
snuverink_j's avatar
snuverink_j committed
656 657
and change the bend input to:

snuverink_j's avatar
snuverink_j committed
658
\begin{verbatim}
snuverink_j's avatar
snuverink_j committed
659 660 661 662 663 664 665 666
Bend: SBend, ANGLE = 60.0 * Pi / 180.0,
             E1 = -10.0 * Pi / 180.0,
             E2 = 20.0  Pi / 180.0,
	     FMAPFN = "TEST-MAP.T7",
	     ELEMEDGE = 0.25,
	     DESIGNENERGY = 10.0E6,
             L = 0.25,
	     GAP = 0.02;
snuverink_j's avatar
snuverink_j committed
667
\end{verbatim}
snuverink_j's avatar
snuverink_j committed
668 669
This results in the same output as the previous example, as we expect.

snuverink_j's avatar
snuverink_j committed
670
\begin{verbatim}
snuverink_j's avatar
snuverink_j committed
671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693
SBend > Reference Trajectory Properties
SBend > ===============================
SBend >
SBend > Bend angle magnitude:    1.0472 rad (60 degrees)
SBend > Entrance edge angle:     -0.174533 rad (-10 degrees)
SBend > Exit edge angle:         0.349066 rad (20 degrees)
SBend > Bend design radius:      0.25 m
SBend > Bend design energy:      1e+07 eV
SBend >
SBend > Bend Field and Rotation Properties
SBend > ==================================
SBend >
SBend > Field amplitude:         -0.140385 T
SBend > Field index (gradient):  0 m^-1
SBend > Rotation about x axis:   0 rad (0 degrees)
SBend > Rotation about y axis:   0 rad (0 degrees)
SBend > Rotation about z axis:   0 rad (0 degrees)
SBend >
SBend > Reference Trajectory Properties Through Bend Magnet with Fringe Fields
SBend > ======================================================================
SBend >
SBend > Reference particle is bent: 1.0472 rad (60 degrees) in x plane
SBend > Reference particle is bent: 0 rad (0 degrees) in y plane
snuverink_j's avatar
snuverink_j committed
694
\end{verbatim}
snuverink_j's avatar
snuverink_j committed
695 696 697

As a final example, let us now use the previous field map with the following input:

snuverink_j's avatar
snuverink_j committed
698
\begin{verbatim}
snuverink_j's avatar
snuverink_j committed
699 700 701 702 703 704 705 706
Bend: SBend, K0 = -0.1400778,
             E1 = -10.0 * Pi / 180.0,
             E2 = 20.0  Pi / 180.0,
	     FMAPFN = "TEST-MAP.T7",
	     ELEMEDGE = 0.25,
	     DESIGNENERGY = 10.0E6,
             L = 0.25,
	     GAP = 0.02;
snuverink_j's avatar
snuverink_j committed
707 708
\end{verbatim}
Instead of setting the bend strength using \texttt{ANGLE}, we use \texttt{K0}. This results in the following output:
snuverink_j's avatar
snuverink_j committed
709

snuverink_j's avatar
snuverink_j committed
710
\begin{verbatim}
snuverink_j's avatar
snuverink_j committed
711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733
SBend > Reference Trajectory Properties
SBend > ===============================
SBend >
SBend > Bend angle magnitude:    1.0472 rad (60 degrees)
SBend > Entrance edge angle:     -0.174533 rad (-10 degrees)
SBend > Exit edge angle:         0.349066 rad (20 degrees)
SBend > Bend design radius:      0.25 m
SBend > Bend design energy:      1e+07 eV
SBend >
SBend > Bend Field and Rotation Properties
SBend > ==================================
SBend >
SBend > Field amplitude:         -0.140078 T
SBend > Field index (gradient):  0 m^-1
SBend > Rotation about x axis:   0 rad (0 degrees)
SBend > Rotation about y axis:   0 rad (0 degrees)
SBend > Rotation about z axis:   0 rad (0 degrees)
SBend >
SBend > Reference Trajectory Properties Through Bend Magnet with Fringe Fields
SBend > ======================================================================
SBend >
SBend > Reference particle is bent: 1.04491 rad (59.8688 degrees) in x plane
SBend > Reference particle is bent: 0 rad (0 degrees) in y plane
snuverink_j's avatar
snuverink_j committed
734
\end{verbatim}
snuverink_j's avatar
snuverink_j committed
735 736 737 738 739 740
In this case, the bend angle for the reference trajectory in the first section of the output
no longer matches the reference trajectory bend angle from the lower section (although the difference is small).
The reason is that the path of the reference particle through the real magnet (with fringe fields) no longer
matches the ideal trajectory. (The effective length of the real magnet is not quite the same as the hard
edged magnet for the reference trajectory.)

snuverink_j's avatar
snuverink_j committed
741
We can compensate for this by changing the field map file \textit{TEST-MAP.T7} file to:
snuverink_j's avatar
snuverink_j committed
742
\begin{verbatim}
snuverink_j's avatar
snuverink_j committed
743 744 745 746 747 748 749
1DProfile1 1 1 2.0
 -10.0  -0.03026  10.0 1
 -10.0  0.03026  10.0 1
  0.00000E+00
  2.00000E+00
  0.00000E+00
  2.00000E+00
snuverink_j's avatar
snuverink_j committed
750
\end{verbatim}
snuverink_j's avatar
snuverink_j committed
751 752
We have moved the Enge function origins see~Section~\ref{1DProfile1} outward from the entrance
and exit faces of the magnet see~Section~\ref{1DProfile1} by 0.3026 mm. This has the effect of making the
snuverink_j's avatar
snuverink_j committed
753 754
effective length of the soft edge magnet longer. When we do this, the same input:

snuverink_j's avatar
snuverink_j committed
755
\begin{verbatim}
snuverink_j's avatar
snuverink_j committed
756 757 758 759 760 761 762 763
Bend: SBend, K0 = -0.1400778,
             E1 = -10.0 * Pi / 180.0,
             E2 = 20.0  Pi / 180.0,
	     FMAPFN = "TEST-MAP.T7",
	     ELEMEDGE = 0.25,
	     DESIGNENERGY = 10.0E6,
             L = 0.25,
	     GAP = 0.02;
snuverink_j's avatar
snuverink_j committed
764
\end{verbatim}
snuverink_j's avatar
snuverink_j committed
765 766
produces

snuverink_j's avatar
snuverink_j committed
767
\begin{verbatim}
snuverink_j's avatar
snuverink_j committed
768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790
SBend > Reference Trajectory Properties
SBend > ===============================
SBend >
SBend > Bend angle magnitude:    1.0472 rad (60 degrees)
SBend > Entrance edge angle:     -0.174533 rad (-10 degrees)
SBend > Exit edge angle:         0.349066 rad (20 degrees)
SBend > Bend design radius:      0.25 m
SBend > Bend design energy:      1e+07 eV
SBend >
SBend > Bend Field and Rotation Properties
SBend > ==================================
SBend >
SBend > Field amplitude:         -0.140078 T
SBend > Field index (gradient):  0 m^-1
SBend > Rotation about x axis:   0 rad (0 degrees)
SBend > Rotation about y axis:   0 rad (0 degrees)
SBend > Rotation about z axis:   0 rad (0 degrees)
SBend >
SBend > Reference Trajectory Properties Through Bend Magnet with Fringe Fields
SBend > ======================================================================
SBend >
SBend > Reference particle is bent: 1.0472 rad (60 degrees) in x plane
SBend > Reference particle is bent: 0 rad (0 degrees) in y plane
snuverink_j's avatar
snuverink_j committed
791
\end{verbatim}
snuverink_j's avatar
snuverink_j committed
792 793 794 795
Now we see that the bend angle for the ideal, hard edge magnet, matches the bend angle of the
reference particle through the soft edge magnet. In other words, the effective length of the soft edge,
 real magnet is the same as the hard edge magnet described by the reference trajectory.

796
\subsection{Bend Fields from 1D Field Maps (\textit{OPAL-t})}
snuverink_j's avatar
snuverink_j committed
797 798 799 800 801 802
\label{ssec:opaltrbendsbendfields}

\begin{figure}[tbh]
\begin{center}
\includegraphics[width=\textwidth]{figures/Elements/Enge-func-plot.png}
\end{center}
snuverink_j's avatar
snuverink_j committed
803
\caption{Plot of the entrance fringe field of a dipole magnet along the mid-plane, perpendicular to its entrance face. The field is normalized to 1.0. In this case, the fringe field is described by an Enge function see~Equation~\ref{enge_func} with the parameters from the default \texttt{1DProfile1} field map described in Section~\ref{benddefaultfieldmapopalt}. The exit fringe field of this magnet is the mirror image.}
snuverink_j's avatar
snuverink_j committed
804 805 806
\label{fig:rbend_enge_fringe}
\end{figure}

807
So far we have described how to setup an \texttt{RBEND} or \texttt{SBEND} element, but have not explained how \textit{OPAL-t} uses this information to calculate the magnetic field. The field of both types of magnets is divided into three regions:
snuverink_j's avatar
snuverink_j committed
808 809 810 811 812
\begin{enumerate}
\item Entrance fringe field.
\item Central field.
\item Exit fringe field.
\end{enumerate}
snuverink_j's avatar
snuverink_j committed
813
This can be seen clearly in Figure~\ref{rbend_field_profile}.
snuverink_j's avatar
snuverink_j committed
814

snuverink_j's avatar
snuverink_j committed
815
The purpose of the \texttt{1DProfile1} field map see~Section~\ref{1DProfile1} associated with the element is to define the Enge functions (Equation~\ref{enge_func}) that model the entrance and exit fringe fields. To model a particular bend magnet, one must fit the field profile along the mid-plane of the magnet perpendicular to its face for the entrance and exit fringe fields to the Enge function:
snuverink_j's avatar
snuverink_j committed
816 817 818 819 820

\begin{equation}\label{eq:enge_func}
  F(z) = \frac{1}{1 + e^{\sum\limits_{n=0}^{N_{order}} c_{n} (z/D)^{n}}}
\end{equation}
where $D$ is the full gap of the magnet, $N_{order}$ is the Enge function order and $z$ is the distance from the origin
snuverink_j's avatar
snuverink_j committed
821
of the Enge function perpendicular to the edge of the dipole. The origin of the Enge function, the order of the Enge function, $N_{order}$, and the constants $c_0$ to $c_{N_{order}}$ are free parameters that are chosen so that the function closely approximates the fringe region of the magnet being modeled. An example of the entrance fringe field is shown in Figure~\ref{rbend_enge_fringe}.
snuverink_j's avatar
snuverink_j committed
822

823
Let us assume we have a correctly defined positive \texttt{RBEND} or \texttt{SBEND} element as illustrated in Figure~\ref{rbend,sbend}. (As already stated, any bend can be described by a rotated positive bend.) \textit{OPAL-t} then has the following information:
snuverink_j's avatar
snuverink_j committed
824 825 826 827

\begin{align*}
B_0 &= \text{Field amplitude (T)} \\
R &= \text{Bend radius (m)} \\
snuverink_j's avatar
snuverink_j committed
828
n &= -\frac{R}{B_{y}}\frac{\partial B_y}{\partial x} \text{ (Field index, set using the parameter \texttt{K1})} \\
snuverink_j's avatar
snuverink_j committed
829 830 831 832 833 834 835 836
F(z) &= \left\{
\begin{array}{lll}
	& F_{entrance}(z_{entrance}) \\
	& F_{center}(z_{center}) = 1 \\
	& F_{exit}(z_{exit})
\end{array}
\right.
\end{align*}
snuverink_j's avatar
snuverink_j committed
837
Here, we have defined an overall Enge function, $F(z)$, with three parts: entrance, center and exit. The exit and entrance fringe field regions have the form of Equation~\ref{enge_func} with parameters defined by the \texttt{1DProfile1} field map file given by the element parameter \texttt{FMAPFN}. Defining the coordinates:
snuverink_j's avatar
snuverink_j committed
838 839 840

\begin{align*}
y &\equiv \text{Vertical distance from magnet mid-plane} \\
snuverink_j's avatar
snuverink_j committed
841
\Delta_x &\equiv \text{Perpendicular distance to reference trajectory (see Figure~\ref{rbend,sbend})} \\
snuverink_j's avatar
snuverink_j committed
842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858
\Delta_z &\equiv \left\{
\begin{array}{lll}
	& \text{Distance from entrance Enge function origin perpendicular to magnet entrance face.} \\
	& \text{Not defined, Enge function is always 1 in this region.} \\
	& \text{Distance from exit Enge function origin perpendicular to magnet exit face.}
\end{array}
\right.
\end{align*}
using the conditions

\begin{align*}
\nabla \cdot \overrightarrow{B} &= 0 \\
\nabla \times \overrightarrow{B} &= 0
\end{align*}
and making the definitions:

\begin{align*}
snuverink_j's avatar
snuverink_j committed
859 860 861
F'(z) &\equiv   \frac{\mathrm{d} F(z)}{\mathrm{d} z} \\
F''(z) &\equiv  \frac{\mathrm{d^{2}} F(z)}{\mathrm{d} z^{2}} \\
F'''(z) &\equiv \frac{\mathrm{d^{3}} F(z)}{\mathrm{d} z^{3}}
snuverink_j's avatar
snuverink_j committed
862 863 864 865
\end{align*}
we can expand the field off axis, with the result:

\begin{align*}
snuverink_j's avatar
snuverink_j committed
866
B_x(\Delta_x, y, \Delta_z) &= -\frac{B_0 \frac{n}{R}}{\sqrt{\frac{n^2}{R^2} +  \frac{F''(\Delta_z)}{F(\Delta_z}}} e^{-\frac{n}{R} \Delta_x} \sin \left[ \left( \sqrt{\frac{n^2}{R^2} + \frac{F''(\Delta_z)}{F(\Delta_z)}} \right) y \right] F(\Delta_z) \\
snuverink_j's avatar
snuverink_j committed
867
B_y(\Delta_x, y, \Delta_z) &= B_0 e^{-\frac{n}{R} \Delta_x} \cos \left[ \left( \sqrt{\frac{n^2}{R^2} + \frac{F''(\Delta_z)}{F(\Delta_z)}} \right) y \right] F(\Delta_z) \\
snuverink_j's avatar
snuverink_j committed
868 869
B_z(\Delta_x, y, \Delta_z) &= B_0 e^{-\frac{n}{R} \Delta_x} \left\{\frac{F'(\Delta_z)}{\sqrt{\frac{n^2}{R^2} + \frac{F''(\Delta_z)}{F(\Delta_z)}}} \sin \left[ \left( \sqrt{\frac{n^2}{R^2} + \frac{F''(\Delta_z)}{F(\Delta_z)}} \right) y \right] \right. \\
&- \frac{1}{2 \sqrt{\frac{n^2}{R^2} + \frac{F''(\Delta_z)}{F(\Delta_z)}}} \left(F'''(\Delta_z) - \frac{F'(\Delta_z) F''(\Delta_z)}{F(\Delta_z)} \right) \left[ \frac{\sin \left[ \left( \sqrt{\frac{n^2}{R^2} + \frac{F''(\Delta_z)}{F(\Delta_z)}} \right) y \right]}{\frac{n^2}{R^2} + \frac{F''(\Delta_z)}{F(\Delta_z)}} \right. \\
snuverink_j's avatar
snuverink_j committed
870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887
&- \left. \left. y \frac{\cos \left[ \left( \sqrt{\frac{n^2}{R^2} + \frac{F''(\Delta_z)}{F(\Delta_z)}} \right) y \right]}{\sqrt{\frac{n^2}{R^2} + \frac{F''(\Delta_z)}{F(\Delta_z)}}} \right] \right\}
\end{align*}
These expression are not well suited for numerical calculation, so, we expand them about $y$ to $O(y^2)$ to obtain:

\begin{itemize}
\item In fringe field regions:
\begin{align*}
B_x(\Delta_x, y, \Delta_z) &\approx -B_0 \frac{n}{R} e^{-\frac{n}{R} \Delta_x} y \\
B_y(\Delta_x, y, \Delta_z) &\approx B_0 e^{-\frac{n}{R} \Delta_x} \left[ F(\Delta_z) - \left( \frac{n^2}{R^2} F(\Delta_z) + F''(\Delta_z) \right) \frac{y^2}{2} \right] \\
B_z(\Delta_x, y, \Delta_z) &\approx B_0 e^{-\frac{n}{R} \Delta_x} y F'(\Delta_z)
\end{align*}
\item In central region:
\begin{align*}
B_x(\Delta_x, y, \Delta_z) &\approx -B_0 \frac{n}{R} e^{-\frac{n}{R} \Delta_x} y \\
B_y(\Delta_x, y, \Delta_z) &\approx B_0 e^{-\frac{n}{R} \Delta_x} \left[ 1 -  \frac{n^2}{R^2} \frac{y^2}{2} \right] \\
B_z(\Delta_x, y, \Delta_z) &\approx 0
\end{align*}
\end{itemize}
888
These are the expressions \textit{OPAL-t} uses to calculate the field inside an \texttt{RBEND} or \texttt{SBEND}. First, a particle's position inside the bend is determined (entrance region, center region, or exit region). Depending on the region, \textit{OPAL-t} then determines the values of $\Delta_x$, $y$ and $\Delta_z$, and then calculates the field values using the above expressions.
snuverink_j's avatar
snuverink_j committed
889

890
\subsection{Default Field Map (\textit{OPAL-t})}
snuverink_j's avatar
snuverink_j committed
891 892 893 894 895 896
\label{ssec:benddefaultfieldmapopalt}
\index{RBEND!Default Field Map}
\index{SBEND!Default Field Map}
\index{Default Field Map}
\index{1DPROFILE1-DEFAULT}
Rather than force users to calculate the field of a dipole and then fit that field to find Enge coefficients
snuverink_j's avatar
snuverink_j committed
897
for the dipoles in their simulation, we have a default set of values we use from \ref{enge} that are set
snuverink_j's avatar
snuverink_j committed
898
when the default field map, ``\texttt{1DPROFILE1-DEFAULT}'' is used:
snuverink_j's avatar
snuverink_j committed
899 900 901 902 903 904 905 906 907 908 909 910 911

\begin{align*}
  c_{0} &= 0.478959 \\
  c_{1} &= 1.911289 \\
  c_{2} &= -1.185953 \\
  c_{3} &= 1.630554 \\
  c_{4} &= -1.082657 \\
  c_{5} &= 0.318111
\end{align*}
The same values are used for both the entrance and exit regions of the magnet. In general they will
give good results. (Of course, at some point as a beam line design becomes more advanced, one will want to find
Enge coefficients that fit the actual magnets that will be used in a given design.)

snuverink_j's avatar
snuverink_j committed
912
The default field map is the equivalent of the following custom \texttt{1DProfile1} (see Section~\ref{1DProfile1} for an explanation of the field map format) map:
snuverink_j's avatar
snuverink_j committed
913

snuverink_j's avatar
snuverink_j committed
914
\begin{verbatim}
snuverink_j's avatar
snuverink_j committed
915 916 917 918 919 920 921 922 923 924 925 926 927 928 929
1DProfile1 5 5 2.0
 -10.0 0.0 10.0 1
 -10.0 0.0 10.0 1
  0.478959
  1.911289
 -1.185953
  1.630554
 -1.082657
  0.318111
  0.478959
  1.911289
 -1.185953
  1.630554
 -1.082657
  0.318111
snuverink_j's avatar
snuverink_j committed
930
\end{verbatim}
snuverink_j's avatar
snuverink_j committed
931
As one can see, the default magnet gap for ``\texttt{1DPROFILE1-DEFAULT'}'' is set to {2.0}{\centim}. This value
snuverink_j's avatar
snuverink_j committed
932
can be overridden by the \texttt{GAP} attribute of the magnet (see Section~\ref{RBend,SBend}).
snuverink_j's avatar
snuverink_j committed
933 934 935 936 937 938 939 940 941

\clearpage

\subsection{SBend3D (OPAL-CYCL)} \label{ssec:SBend3D}
\index{SBEND3D}
% NOTE: SBEND3D, RINGDEFINITION in elements.tex and \ubsection {3D fieldmap} in
% opalcycl.tex all refer to each other - if updating one check for update on
% others to keep them consistent.
The SBend3D element enables definition of a bend from 3D field maps. This can be
snuverink_j's avatar
snuverink_j committed
942
used in conjunction with the \texttt{RINGDEFINITION} element to make a ring for
943
tracking through \textit{OPAL-cycl}.
snuverink_j's avatar
snuverink_j committed
944

snuverink_j's avatar
snuverink_j committed
945
\begin{verbatim}
snuverink_j's avatar
snuverink_j committed
946
label: SBEND3D, FMAPFN=string, LENGTH_UNITS=real, FIELD_UNITS=real;
snuverink_j's avatar
snuverink_j committed
947
\end{verbatim}
snuverink_j's avatar
snuverink_j committed
948 949 950 951 952 953 954 955 956 957 958 959

\begin{kdescription}
\item[FMAPFN]
  The field map file name.
\item[LENGTH\_UNITS]
  Units for length (set to 1.0 for units in mm, 10.0 for units in cm, etc).
\item[FIELD\_UNITS]
  Units for field (set to 1.0 for units in T, 0.001 for units in mT, etc).
\end{kdescription}

Field maps are defined using Cartesian coordinates but in a polar geometry with the following restrictions/conventions:
\begin{enumerate}
960
\item	3D Field maps have to be generated in the vertical direction (z coordinate in \textit{OPAL-cycl}) from z = 0 upwards. It cannot be generated symmetrically about z = 0 towards negative z values.
snuverink_j's avatar
snuverink_j committed
961 962 963 964
\item	Field map file must be in the form with columns ordered as follows: [$x, z, y, B_{x}, B_{z}, B_{y}$].
\item	Grid points of the position and field strength have to be written on a grid in ($r, z, \theta$) with the primary direction corresponding to the azimuthal direction, secondary to the vertical direction and tertiary to the radial direction.
\end{enumerate}

snuverink_j's avatar
snuverink_j committed
965
Below two examples of a \texttt{SBEND3D} which loads a field maps with different units. The \texttt{triplet} example has units of cm and fields units
snuverink_j's avatar
snuverink_j committed
966
of Gauss, where the \texttt{Dipole} example (Figure~\ref{sbend3d1}) uses meter and Tesla. The first 8 lines in the field map are ignored.
snuverink_j's avatar
snuverink_j committed
967

snuverink_j's avatar
snuverink_j committed
968
\begin{verbatim}
snuverink_j's avatar
snuverink_j committed
969
triplet: SBEND3D, FMAPFN="fdf-tosca-field-map.table", LENGTH_UNITS=10., FIELD_UNITS=-1e-4;
snuverink_j's avatar
snuverink_j committed
970
\end{verbatim}
snuverink_j's avatar
snuverink_j committed
971

snuverink_j's avatar
snuverink_j committed
972
The first few links of the field map \textit{fdf-tosca-field-map.table}:
snuverink_j's avatar
snuverink_j committed
973

snuverink_j's avatar
snuverink_j committed
974
\begin{verbatim}
snuverink_j's avatar
snuverink_j committed
975 976 977 978 979 980 981 982 983 984 985 986
      422280      422280      422280           1
 1 X [LENGU]
 2 Y [LENGU]
 3 Z [LENGU]
 4 BX [FLUXU]
 5 BY [FLUXU]
 6 BZ [FLUXU]
 0
 194.01470 0.0000000 80.363520 0.68275932346E-07 -5.3752492577 0.28280706805E-07
 194.36351 0.0000000 79.516210 0.42525693524E-07 -5.3827955117 0.17681348191E-07
 194.70861 0.0000000 78.667380 0.19766168358E-07 -5.4350026348 0.82540823165E-08
.....
snuverink_j's avatar
snuverink_j committed
987
\end{verbatim}
snuverink_j's avatar
snuverink_j committed
988

snuverink_j's avatar
snuverink_j committed
989
\begin{verbatim}
snuverink_j's avatar
snuverink_j committed
990
Dipole:SBEND3D,FMAPFN="90degree_Dipole_Magnet.out",LENGTH_UNITS=1000.0, FIELD_UNITS=-10.0;
snuverink_j's avatar
snuverink_j committed
991
\end{verbatim}
snuverink_j's avatar
snuverink_j committed
992
The first few links of the field map \textit{90degree\_Dipole\_Magnet.out}:
snuverink_j's avatar
snuverink_j committed
993
\begin{verbatim}
snuverink_j's avatar
snuverink_j committed
994 995 996 997 998 999 1000 1001 1002 1003 1004 1005
	4550000	4550000	4550000	1
X [LENGTH_UNITS]
Z [LENGTH_UNITS]
Y [LENGTH_UNITS]
BX [FIELD_UNITS]
BZ [FIELD_UNITS]
BY [FIELD_UNITS]
0
4.3586435e-01   5.0000000e-02   1.2803431e+00   0.0000000e+00   1.6214000e+00   0.0000000e+00
4.2691532e-01   5.0000000e-02   1.2833548e+00   0.0000000e+00   1.6214000e+00   0.0000000e+00
4.1794548e-01   5.0000000e-02   1.2863039e+00   0.0000000e+00   1.6214000e+00   0.0000000e+00
...
snuverink_j's avatar
snuverink_j committed
1006
\end{verbatim}
snuverink_j's avatar
snuverink_j committed
1007 1008


1009
This is a restricted feature: \textit{OPAL-cycl}.
snuverink_j's avatar
snuverink_j committed
1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027

\begin{figure}[tb]
\begin{center}
\includegraphics[width=0.58\textwidth]{figures/Elements/sbend3d-1}
\includegraphics[width=0.4\textwidth]{figures/Elements/sbend3d-2}
\end{center}
\caption{A hard edge model of $90$ degree dipole magnet with homogeneous magnetic field. The right figure
is showing the horizontal cross section of the 3D magnetic field map when $z = 0$}
\label{fig:sbend3d1}
\end{figure}
\index{Bending Magnets|)}



\clearpage
\section{Quadrupole}
\label{sec:quadrupole}
\index{QUADRUPOLE}
snuverink_j's avatar
snuverink_j committed
1028
\begin{verbatim}
snuverink_j's avatar
snuverink_j committed
1029 1030
label:QUADRUPOLE, TYPE=string, APERTURE=real-vector,
      L=real, K1=real, K1S=real;
snuverink_j's avatar
snuverink_j committed
1031
\end{verbatim}
snuverink_j's avatar
snuverink_j committed
1032 1033

The reference system for a quadrupole is a Cartesian coordinate system
1034
\ifthenelse{\boolean{ShowMap}}{see~Figure~\ref{straight}}{}. This is a restricted feature:  \texttt{DOPAL-cycl}.
snuverink_j's avatar
snuverink_j committed
1035

snuverink_j's avatar
snuverink_j committed
1036
A \texttt{QUADRUPOLE} has three real attributes:
snuverink_j's avatar
snuverink_j committed
1037 1038
\begin{kdescription}
\item[K1]
snuverink_j's avatar
snuverink_j committed
1039
  The normal quadrupole component  $K_1=\frac{\partial B_y}{\partial x}$.
snuverink_j's avatar
snuverink_j committed
1040
  The default is ${0}{Tm^{-1}}$.
snuverink_j's avatar
snuverink_j committed
1041 1042 1043 1044 1045
  The component is positive, if $B_y$ is positive on the positive $x$-axis.
  This implies horizontal focusing of positively charged particles which
  travel in positive $s$-direction.

\item[K1S]
snuverink_j's avatar
snuverink_j committed
1046
  The skew quadrupole component. $K_{1s}=-\frac{\partial B_x}{\partial x}$.
snuverink_j's avatar
snuverink_j committed
1047
  The default is ${0}{Tm^{-1}}$.
snuverink_j's avatar
snuverink_j committed
1048 1049 1050 1051
  The component is negative, if $B_x$ is positive on the positive $x$-axis.
\end{kdescription}

\noindent Example:
snuverink_j's avatar
snuverink_j committed
1052
\begin{verbatim}
snuverink_j's avatar
snuverink_j committed
1053 1054
QP1: Quadrupole, L=1.20, ELEMEDGE=-0.5265,
     FMAPFN="1T1.T7", K1=0.11;
snuverink_j's avatar
snuverink_j committed
1055
\end{verbatim}
snuverink_j's avatar
snuverink_j committed
1056 1057 1058 1059 1060 1061 1062 1063




\clearpage
\section{Sextupole}
\label{sec:sextupole}
\index{SEXTUPOLE}
snuverink_j's avatar
snuverink_j committed
1064
\begin{verbatim}
snuverink_j's avatar
snuverink_j committed
1065 1066
label: SEXTUPOLE, TYPE=string, APERTURE=real-vector,
       L=real, K2=real, K2S=real;
snuverink_j's avatar
snuverink_j committed
1067 1068
\end{verbatim}
A \texttt{SEXTUPOLE} has three real attributes:
snuverink_j's avatar
snuverink_j committed
1069 1070 1071
\begin{kdescription}
\item[K2]
  The normal sextupole component
snuverink_j's avatar
snuverink_j committed
1072 1073
  $K_2=\frac{\partial^2} B_y}{\partial x^2}$.
  The default is ${0}{T m^{-2}}$.
snuverink_j's avatar
snuverink_j committed
1074 1075 1076
  The component is positive, if $B_y$ is positive on the $x$-axis.
\item[K2S]
  The skew sextupole component
snuverink_j's avatar
snuverink_j committed
1077 1078
  $K_{2s}=-\frac{\partial{^2}B_x}{\partial x^{2}}$.
  The default is ${0}{T m^{-2}}$.
snuverink_j's avatar
snuverink_j committed
1079 1080 1081
  The component is negative, if $B_x$ is positive on the $x$-axis.
\end{kdescription}
\noindent Example:
snuverink_j's avatar
snuverink_j committed
1082
\begin{verbatim}
snuverink_j's avatar
snuverink_j committed
1083
S:SEXTUPOLE, L=0.4, K2=0.00134;
snuverink_j's avatar
snuverink_j committed
1084
\end{verbatim}
snuverink_j's avatar
snuverink_j committed
1085
The reference system for a sextupole is a Cartesian coordinate system
snuverink_j's avatar
snuverink_j committed
1086
\ifthenelse{\boolean{ShowMap}}{see~Figure~\ref{straight}}{}.
snuverink_j's avatar
snuverink_j committed
1087 1088 1089 1090 1091 1092


\clearpage
\section{Octupole}
\label{sec:octupole}
\index{OCTUPOLE}
snuverink_j's avatar
snuverink_j committed
1093
\begin{verbatim}
snuverink_j's avatar
snuverink_j committed
1094 1095
label:OCTUPOLE, TYPE=string, APERTURE=real-vector,
      L=real, K3=real, K3S=real;
snuverink_j's avatar
snuverink_j committed
1096 1097
\end{verbatim}
An \texttt{OCTUPOLE} has three real attributes:
snuverink_j's avatar
snuverink_j committed
1098 1099
\begin{kdescription}
\item[K3]
snuverink_j's avatar
snuverink_j committed
1100 1101
  The normal octupole component
  $K_3=\frac{\partial^3} B_y}{\partial x^3}$.
snuverink_j's avatar
snuverink_j committed
1102
  The default is ${0}{Tm^{-3}}$.
snuverink_j's avatar
snuverink_j committed
1103 1104
  The component is positive, if $B_y$ is positive on the positive $x$-axis.
\item[K3S]
snuverink_j's avatar
snuverink_j committed
1105 1106
  The skew octupole component
  $K_{3s}=-\frac{\partial{^3}B_x}{\partial x^{3}}$.
snuverink_j's avatar
snuverink_j committed
1107
  The default is ${0}{Tm^{-3}}$.
snuverink_j's avatar
snuverink_j committed
1108 1109 1110
  The component is negative, if $B_x$ is positive on the positive $x$-axis.
\end{kdescription}
\noindent Example:
snuverink_j's avatar
snuverink_j committed
1111
\begin{verbatim}
snuverink_j's avatar
snuverink_j committed
1112
O3:OCTUPOLE, L=0.3, K3=0.543;
snuverink_j's avatar
snuverink_j committed
1113
\end{verbatim}
snuverink_j's avatar
snuverink_j committed
1114
The reference system for an octupole is a Cartesian coordinate system
snuverink_j's avatar
snuverink_j committed
1115
\ifthenelse{\boolean{ShowMap}}{see~Figure~\ref{straight}}{}.
snuverink_j's avatar
snuverink_j committed
1116 1117 1118 1119 1120

\clearpage
\section{General Multipole}
\label{sec:multipole}
\index{MULTIPOLE}
1121
A \texttt{MULTIPOLE} is in \textit{OPAL-t} is of arbitrary order.