benchmarks.tex 48.3 KB
Newer Older
snuverink_j's avatar
snuverink_j committed
1 2 3 4
\input{header}
\chapter{Benchmarks}
\label{chp:benchmarks}

5
\section{\textit{OPAL-t} compared with TRANSPORT \& TRACE 3D}
snuverink_j's avatar
snuverink_j committed
6 7 8
\label{sec:T3D}

\subsection{TRACE 3D}
snuverink_j's avatar
snuverink_j committed
9
TRACE 3D is an interactive beam dynamics program that calculates the envelopes of a bunched beam, including linear space-change forces  \ref{Trace_man}. It provides an instantaneous beam profile diagram and delineates the transverse and longitudinal phase plane, where the ellipses are characterized by the Twiss parameters and emittances (total and unnormalized).
snuverink_j's avatar
snuverink_j committed
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38

\subsection{TRACE 3D Units}
\label{ssec:T3D_units}

TRACE 3D supports the following internal coordinates and units for the three phase planes:

\begin{itemize}
\item \textbf{horizontal plane:} \\
x [mm] is the displacement from the center of the beam bunch;\\
x' [mrad] is the beam divergence;

\item \textbf{vertical plane:}\\
y [mm] is the displacement from the center of the beam bunch; \\
y' [mrad] is the beam divergence;

\item \textbf{longitudinal plane:}\\
z [mm] is the displacement from the center of the beam bunch; \\
$\Delta$p/p [mrad] is the difference between the particle's longitudinal momentum and the reference momentum of the beam bunch.
\end{itemize}

For input and output, however, z and $\Delta$p/p are replaced by $\Delta\phi$ [degree] and $\Delta$W [keV], respectively the displacement in phase and energy. The relationships between these longitudinal coordinates are:

\begin{equation}
z = -\frac{\beta\lambda}{360}\Delta\phi
\end{equation}
and
\begin{equation}
\frac{\Delta p}{p} = \frac{\gamma}{\gamma +1}\frac{\Delta W}{W}
\end{equation}
snuverink_j's avatar
snuverink_j committed
39
where $\beta$ and $\gamma$ are the relativist parameters, $\lambda$ is the free-space wavelength of the RF and W is the kinetic energy [{MeV}] at the beam center. This internal conversion can be displayed using the \textit{command W} (see \ref{Trace_man} page 42).
snuverink_j's avatar
snuverink_j committed
40 41 42 43
\subsection{TRACE 3D Input beam}
\label{ssec:T3D_input}
In TRACE 3D, the input beam is described by the following set of parameters:
\begin{itemize}
snuverink_j's avatar
snuverink_j committed
44
\item \textbf{ER}: particle rest mass [{MeV/\squarec}];
snuverink_j's avatar
snuverink_j committed
45
\item \textbf{Q}: charge state (+1 for protons);
snuverink_j's avatar
snuverink_j committed
46
\item \textbf{W}: beam kinetic energy [{MeV}]
snuverink_j's avatar
snuverink_j committed
47
\item \textbf{XI}: beam current [{mA}]
snuverink_j's avatar
snuverink_j committed
48 49 50 51 52 53 54 55 56 57 58 59 60 61
\item \textbf{BEAMI}: array with initial Twiss parameters in the three phase planes
\begin{center}
BEAMI = $\alpha_x , \beta_x, \alpha_y, \beta_y, \alpha_{\phi}, \beta_{\phi} $ \\
\end{center}
The alphas are dimensionless, $\beta_x$ and $\beta_y$ are expressed in m/rad (or mm/mrad) and $\beta_{\phi}$ in deg/keV;
\item \textbf{EMITI}: initial total and unnormalized emittances in x-x', y-y', and $\Delta\phi$-$\Delta W$ planes.
\begin{center}
EMITI = $\epsilon_x , \epsilon_y, \epsilon_{\phi} $ \\
\end{center}
The transversal emittances are expressed in $\pi$-mm-mrad and in $\pi$-deg-keV the longitudinal emittance.
\end{itemize}
In this beam dynamics code, the total emittance in each phase plane is five times the RMS emittance in that plane and the displayed beam envelopes are $\sqrt{5}$-times their respective RMS values.
\subsubsection{TRACE 3D Graphic Interface}
\label{ssec:T3D_graphic}
snuverink_j's avatar
snuverink_j committed
62
An example of TRACE 3D graphic interface is shown in Figure~\ref{trace}.
snuverink_j's avatar
snuverink_j committed
63 64 65 66 67 68 69 70 71 72 73 74
\begin{figure}[htbp]
\centering
  \includegraphics[width=\textwidth-1cm, keepaspectratio=true]{figures/Benchmarks/Trace.png}
    \caption{TRACE 3D graphic interface where: (1) input beam in transverse plane (above) and longitudinal plane (below); (2) output beam in transverse plane (above) and longitudinal plane (below); (3) summary of beam parameters such as input and output emittances and desired value for matching function; (4) line lattice with different elements and beam envelope. The color legend is: blue line for horizontal plane, red line for vertical plane, green line for longitudinal plane and yellow line for dispersion.}
    \label{fig:trace}
\end{figure}
\clearpage
%----------------------------------------------------------------------------------------
%    SECTION 2: TRANSPORT
%----------------------------------------------------------------------------------------
\subsection{TRANSPORT}
\label{sec:TRAN}
snuverink_j's avatar
snuverink_j committed
75
TRANSPORT is a computer program for first-order and second-order matrix multiplication, intended for the design of beam transport system \ref{bib:transport}. The TRANSPORT version for Windows provides a graphic beam profile diagram, as well as a sigma matrix description of the simulated beam and line \ref{Transport_GUI}.
snuverink_j's avatar
snuverink_j committed
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
Differently from TRACE 3D, the ellipses are characterized by the sigma-matrix coefficients and the Twiss parameters and emittances (total and unnormalized) are reported as output information.
\subsection{TRANSPORT Units}
\label{ssec:TRAN_units}
At any specified position in the system, an arbitrary charged particle is represented by a vector, whose components are positions, angles and momentum of the particle with respect to the reference trajectory. The standard units and internal coordinates in TRANSPORT are:
\begin{itemize}
\item \textbf{horizontal plane:} \\
x [cm] is the displacement of the arbitrary ray with respect to the assumed central trajectory;\\
$\theta$ [mrad] is the angle the ray makes with respect to the assumed central trajectory;
\item \textbf{vertical plane:}\\
y [cm] is the displacement of the arbitrary ray with respect to the assumed central trajectory;\\
$\phi$ [mrad] is the angle the ray makes with respect to the assumed central trajectory;
\item \textbf{longitudinal plane:}\\
l [cm] is the path length difference between the arbitrary ray and the central trajectory;\\
$\delta$ [\%] is the fractional momentum deviation of the ray from the assumed central trajectory.
\end{itemize}
snuverink_j's avatar
snuverink_j committed
91
Even if TRANSPORT supports this standard set of units [cm, mrad and \%]; however using \textbf{card 15}, the users can redefine the units (see page 99 on TRANSPORT documentation \ref{bib:transport} for more details).
snuverink_j's avatar
snuverink_j committed
92 93 94 95
\subsection{TRANSPORT Input beam}
\label{ssec:TRAN_input}
The input beam is described in \textbf{card 1} in terms of the semi-axes of a six-dimensional erect ellipsoid beam. In terms of diagonal sigma-matrix elements, the input beam in TRANSPORT is expressed by 7 parameters:
\begin{itemize}
snuverink_j's avatar
snuverink_j committed
96 97 98
\item $\sqrt{\sigma_{ii}}$ [cm] represents one-half of the horizontal (i=1), vertical (i=3) and longitudinal extent (i=5);
\item $\sqrt{\sigma_{ii}}$ [mrad] represents one-half of the horizontal (i=2), vertical (i=4) beam divergence;
\item $\sqrt{\sigma_{66}}$ [\%] represents one-half of the momentum spread;
snuverink_j's avatar
snuverink_j committed
99 100 101 102
\item p(0) is the momentum of the central trajectory  [GeV/c].
\end{itemize}
If the input beam is tilted (Twiss alphas not zero), \textbf{ card 12} must be used, inserting the 15 correlations $r_{ij}$ parameters among the 6 beam components. The correlation parameters are defined as following:
\begin{equation}
snuverink_j's avatar
snuverink_j committed
103
r_{ij}=\frac{\sigma_{ij}}{\sqrt{\sigma_{ii}gma_{jj}}}
snuverink_j's avatar
snuverink_j committed
104
\end{equation}
snuverink_j's avatar
snuverink_j committed
105
As explained before, with the \textbf{card 15}, it is possible to transform the TRANSPORT standard units in TRACE-like units. In this way, the TRACE 3D sigma-matrix for the input beam, printed out by \textit{command Z}, can be directly used as input beam in TRANSPORT. An example of TRACE 3D sigma-matrix structure is shown in Figure~\ref{trace_z}.
snuverink_j's avatar
snuverink_j committed
106 107 108
\begin{figure}[htbp]
 \centering
     \includegraphics[width=0.5\textwidth-0.6cm, keepaspectratio=true]{figures/Benchmarks/TRACE_z.png}
snuverink_j's avatar
snuverink_j committed
109
    \caption{Sigma-matrix structure in TRACE 3D \ref{Trace_man}}
snuverink_j's avatar
snuverink_j committed
110 111 112 113 114
    \label{fig:trace_z}
\end{figure}
From the sigma-matrix coefficients, TRANSPORT reports in output the Twiss parameters and the total, unnormalized emittance. Even in this case, a factor 5 is present between the emittances calculated by TRANSPORT and the corresponding RMS values.
\subsubsection{TRANSPORT Graphic Interface}
\label{ssec:TRAN_graphic}
snuverink_j's avatar
snuverink_j committed
115
An improved version of TRANSPORT has been embedded in a new graphic shell written in C++ and is providing GUI type tools, which makes it easier to design new beam lines. A screen shot of a modern GUI Transport interface \ref{Transport_GUI} is shown in Figure~\ref{TRANSPORT}.
snuverink_j's avatar
snuverink_j committed
116 117 118
\begin{figure}[htbp]
 \centering
     \includegraphics[width=\textwidth-1cm, keepaspectratio=true]{figures/Benchmarks/TRANSPORT.png}
snuverink_j's avatar
snuverink_j committed
119
    \caption{GUI TRANSPORT graphic interface \ref{Tran_ex}. The continuous lines describe the beam envelope in the vertical plane (above) and horizontal plane (below). The dashed line displays the dispersion. The elements in the beam line are drawn as blue and red rectangles}
snuverink_j's avatar
snuverink_j committed
120 121 122 123 124 125 126 127 128
 \label{fig:TRANSPORT}
\end{figure}
%\vspace{4cm}

%----------------------------------------------------------------------------------------
%    SECTION 3: COMPARISON TRACE 3D - TRANSPORT
%----------------------------------------------------------------------------------------
\subsection{Comparison TRACE 3D and TRANSPORT}
\label{sec:T3D_TRAN}
snuverink_j's avatar
snuverink_j committed
129
This study has been done following the same trend of the Regression Test in \textit{OPAL} \ref{AMAS}, replacing the electron beam with a same energy proton beam. Due to the different beam rigidity, the bending magnet features have been redefined with a new magnetic field.
snuverink_j's avatar
snuverink_j committed
130 131 132 133 134 135 136 137 138 139 140 141 142

The simulated beam transport line contains:
\begin{itemize}
\item drift space (DRIFT 1): 0.250 m length;
\item bending magnet (SBEND or RBEND): 0.250 m radius of curvature;
\item drift space (DRIFT 2): 0.250 m length.
\end{itemize}

Keeping fixed the lattice structure, many similar transport lines have been tested adding entrance and exit edge angles to the bending magnet, changing the bending plane (vertical bending magnet) and direction (right or left). In all the cases, the difficulties arise from the non-achromaticity of the system and an increase in the horizontal and longitudinal emittance is expected. In addition, the coupling between these two planes has to be accurately studied.

In the following paragraph, an example of Sector Bending magnet (SBEND) simulation with entrance and exit edge angles is discussed.

\subsubsection{Input beam}
snuverink_j's avatar
snuverink_j committed
143
The starting simulation has been performed with TRACE 3D code. According to Section~\ref{T3D_input}, the simulated input beam is described by the following parameters:
snuverink_j's avatar
snuverink_j committed
144
\begin{verbatim}
snuverink_j's avatar
snuverink_j committed
145 146 147 148 149
ER = 938.27
W = 7
FREQ = 700
BEAMI = 0.0, 4.0,0.0, 4.0, 0.0, 0.0756
EMITI = 0.730, 0.730, 7.56
snuverink_j's avatar
snuverink_j committed
150
\end{verbatim}
snuverink_j's avatar
snuverink_j committed
151

snuverink_j's avatar
snuverink_j committed
152
Thanks to the TRACE 3D graphic interface, the input beam can immediately be visualized in the three phase plane as shown in Figure~\ref{Input_TRACE}.
snuverink_j's avatar
snuverink_j committed
153 154 155 156 157 158 159 160 161 162 163 164 165 166 167

\begin{figure}[htbp]
 \centering
     \includegraphics[width=0.5\textwidth-0.6cm, keepaspectratio=true]{figures/Benchmarks/Input_Trace.png}
    \caption{TRACE 3D input beam in the transversal plane (above) and in the longitudinal plane (below)}
    \label{fig:Input_TRACE}
\end{figure}
The corresponding sigma-matrix with the relative units is displayed by command Z:
\begin{figure}[htbp]
 \centering
     \includegraphics[width=0.5\textwidth-0.6cm, keepaspectratio=true]{figures/Benchmarks/TRACE_z_input.png}
    \caption{TRACE 3D sigma-matrix for the input beam}
    \label{fig:TRACE_z_Input}
\end{figure}
Before entering the TRACE 3D sigma-matrix coefficients in TRANSPORT, a changing in the units is required using the \textbf{card 15} in the following way:
snuverink_j's avatar
snuverink_j committed
168
\begin{verbatim}
snuverink_j's avatar
snuverink_j committed
169 170
15. 1. 'MM' 0.1 ; //express in mm the horizontal and vertical beam size
15. 5. 'MM' 0.1 ; //express in mm the beam length
snuverink_j's avatar
snuverink_j committed
171
\end{verbatim}
snuverink_j's avatar
snuverink_j committed
172 173

At this point, the TRANSPORT input beam is defined by \textbf{card 1}:
snuverink_j's avatar
snuverink_j committed
174
\begin{verbatim}
snuverink_j's avatar
snuverink_j committed
175
1.0 1.709 0.427 1.709 0.427 0.11 0.0717 0.1148 /BEAM/ ;
snuverink_j's avatar
snuverink_j committed
176
\end{verbatim}
snuverink_j's avatar
snuverink_j committed
177

snuverink_j's avatar
snuverink_j committed
178
using exactly the same sigma-matrix coefficients of Figure~\ref{TRACE_z_Input}. Other two cards must be added in order to use exactly the TRACE 3D R-matrix formalism:
snuverink_j's avatar
snuverink_j committed
179
\begin{verbatim}
snuverink_j's avatar
snuverink_j committed
180 181
16. 3. 1863.153; //proton mass, as ratio of electron mass
22. 0.05 0.0 700 0.0 /SPAC/ ; //space charge card
snuverink_j's avatar
snuverink_j committed
182
\end{verbatim}
snuverink_j's avatar
snuverink_j committed
183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218
\subsubsection{SBEND in TRACE 3D}
The bending magnet definition in TRACE 3D requires:
\begin{table}[htbp]
\centering
  \caption{Bending magnet description in TRACE 3D and values used in the simulation}
  \label{tab:Bend_Trace}
  \begin{tabular}{|l|l|l|}
  \hline
  \tabhead{Parameter & Value & Description}
  \hline
  NT                  &     8          & Type code for bending \\
  $\alpha$ [deg]      &    30          & angle of bend in horizontal plane \\
  $\rho$ [mm]         &   250          & radius of curvature of central trajectory \\
  n                   &     0          & field-index gradient\\
  vf                  &     0          & flag for vertical bending\\
  \hline
  \end{tabular}
\end{table}
The edge angles are described with another type code and parameters which include also the fringe field. They must be added before and after the bending magnet if entrance and exit edge angles are present and if the fringe field has to be taken into account. In particular for the entrance edge angle:
\begin{table}[htbp]
\centering
  \caption{Edge angle description in TRACE 3D and values used in the simulation}
  \label{tab:Edge_Trace}
  \begin{tabular}{|l|l|l|}
  \hline
  \tabhead{Parameter & Value & Description}
  \hline
  NT                 &     9          & Type code for edge \\
  $\beta$ [deg]      &    10          & pole-face rotation \\
  $\rho$ [mm]        &   250          & radius of curvature of central trajectory \\
  g [mm]             &    20          & total gap of magnet \\
  $K_1$              &   0.36945      & fringe-field factor \\
  $K_2$              &   0.36945      & fringe-field factor \\
  \hline
  \end{tabular}
\end{table}
snuverink_j's avatar
snuverink_j committed
219
A same configuration has been used for exit edge angle using $\beta = {5}{^{\circ}}$. The beam envelopes in the three phase planes for this simulation are shown in Figure~\ref{Trace_env}.
snuverink_j's avatar
snuverink_j committed
220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242
\begin{figure}[htbp]
 \centering
     \includegraphics[width=\textwidth-1cm, keepaspectratio=true]{figures/Benchmarks/Trace_SBEND_edge.png}
    \caption{Beam envelopes in TRACE 3D for a SBEND with entrance and exit edge angles. The blue line describes the beam envelope in the horizontal plane, the red line in the vertical plane, the green line in the longitudinal plane. The yellow line displays the dispersion}
    \label{fig:Trace_env}
\end{figure}
\subsubsection{SBEND in TRANSPORT}
The bending magnet definition in TRANSPORT requires:
\begin{table}[htbp]
\centering
\caption{Bending magnet description in TRANSPORT and values used in the simulation}
\label{tab:Bend_Trans}
     \begin{tabular}{|l|l|l|}
        \hline
        \tabhead{Parameter & Value & Description}
        \hline
        Card               & 4     & Type code for bending                      \\
        L [m]              & 30    & Effective length of the central trajectory \\
        $B_0$ [kG]         & 250   & Central field strength                     \\
        n                  & 0     & field-index gradient                       \\
        \hline
       \end{tabular}
\end{table}
snuverink_j's avatar
snuverink_j committed
243
As for TRACE 3D, the edge angles are described with another card and parameters. In TRANSPORT, however, the fringe field is not automatically included with the edge angle, but it is described by a own card as reported in the Table~\ref{Edge_Trans}.
snuverink_j's avatar
snuverink_j committed
244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261
\begin{table}[htbp]
\centering
\caption{Edge angle and fringe field description in TRANSPORT and values used in the simulation}
\label{tab:Edge_Trans}
     \begin{tabular}{|l|l|l|}
        \hline
        \tabhead{Parameter & Value   & Description}
        \hline
        Card               & 2       & Type code for edge         \\
        $\beta$ [deg]      & 10      & pole-face rotation         \\
        \hline
        Card               & 16      & Type code for fringe field \\
        g [mm]             & 10      & half-gap of magnet         \\
        $K_1$              & 0.36945 & fringe-field factor        \\
        $K_2$              & 0.36945 & fringe-field factor        \\
        \hline
        \end{tabular}
\end{table}
snuverink_j's avatar
snuverink_j committed
262
Running the Graphic TRANSPORT version, the beam envelopes in the transverse phase planes for this simulation are shown in Figure~\ref{Tran_env}.
snuverink_j's avatar
snuverink_j committed
263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278
\begin{figure}[htbp]
 \centering
     \includegraphics[width=0.5\textwidth-0.6cm, keepaspectratio=true]{figures/Benchmarks/TRANS_SBEND_edge.png}
    \caption{Beam envelopes in TRANSPORT for a SBEND with entrance and exit edge angles. The continuous lines describe the beam envelope in the vertical plane (above) and horizontal plane (below). The dashed line displays the dispersion.}
    \label{fig:Tran_env}
\end{figure}
\subsubsection{Beam size and emittance comparison}
In the next table, the results of the comparison between TRACE 3D and TRANSPORT in terms of the transversal beam sizes at the end of each element in the line are summarized.
\begin{table}[htbp]
\centering
\caption{Transversal beam size at the end of each element in the line printed out by TRACE 3D and TRANSPORT}
\label{tab:Beam_size}
     \begin{tabular}{|l|l|l|l|l|l|}
        \hline
        \multicolumn{2}{|c|}{}    & \multicolumn{2}{c|}{\tabheadcell{TRACE 3D}}  & \multicolumn{2}{c|}{\tabheadcell{TRANSPORT}}     \\
        \hline
snuverink_j's avatar
snuverink_j committed
279
        Position    & z (m)       &  $\sigma_x$ (mm)   & $\sigma_y$ (mm)         & $\sigma_x$ (mm)  & $\sigma_y$ (mm)               \\
snuverink_j's avatar
snuverink_j committed
280 281 282 283 284 285 286 287 288 289 290 291 292 293 294
        %\hline
        Input       & 0.000       &  1.709             &    1.709                &   1.709          & 1.709                         \\
        %\hline
        Drift 1     & 0.250       &  1.712             &    1.712                &   1.712          & 1.712                         \\
        %\hline
        Edge        & 0.250       &  1.712             &    1.712                &   1.712          & 1.712                         \\
        %\hline
        Bend        & 0.381       &  1.638             &    1.587                &   1.638          & 1.587                         \\
        %\hline
        Edge        & 0.381       &  1.638             &    1.587                &   1.638          & 1.587                         \\
        %\hline
        Drift 2     & 0.631       &  1.206             &    1.264                &   1.206          & 1.264                         \\
        \hline
        \end{tabular}
\end{table}
snuverink_j's avatar
snuverink_j committed
295
The perfect agreement between these two codes arises immediately looking at Figure~\ref{T3D_Tra_env}.
snuverink_j's avatar
snuverink_j committed
296 297 298 299 300 301
\begin{figure}[htbp]
 \centering
     \includegraphics[width=0.5\textwidth-1cm, keepaspectratio=true]{figures/Benchmarks/T3D_Tra_SBEND_edge_env.pdf}
    \caption{Transversal beam size comparison between TRACE 3D and TRANSPORT}
    \label{fig:T3D_Tra_env}
\end{figure}
snuverink_j's avatar
snuverink_j committed
302
The same comparison has been performed in terms of horizontal and longitudinal emittance, both expressed in $\pi$-mm-mrad. While the vertical emittance remains constant and equal to the initial value ($\epsilon_y = $ 0.730 $\pi$-mm-mrad) , the horizontal and longitudinal emittances are expected growing after the bending magnet. The results are reported in Table~\ref{Emittance} and in Figure~\ref{T3D_Tra_emi}.
snuverink_j's avatar
snuverink_j committed
303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375
\begin{table}[htbp]
\centering
\caption{Horizontal and longitudinal emittance comparison between TRACE 3D and TRANSPORT, both expressed in $\pi$-mm-mrad}
\label{tab:Emittance}
     \begin{tabular}{|l|l|l|l|l|l|}
        \hline
        \multicolumn{2}{|c|}{}       & \multicolumn{2}{c|}{\tabheadcell{TRACE 3D}}     & \multicolumn{2}{c|}{\tabheadcell{TRANSPORT}}\\
        \hline
        Position     & z (m)         &  $\epsilon_x$   &   $\epsilon_z$               &   $\epsilon_x$   & $\epsilon_z$              \\
        %\hline
        Input        &     0         &  0.730          &    0.08                      &   0.730          & 0.08                      \\
        %\hline
        Drift 1      &     0.250     &  0.730          &    0.08                      &   0.730          & 0.08                      \\
        %\hline
        Edge         &     0.250     &  0.730          &    0.08                      &   0.730          & 0.08                      \\
        %\hline
        Bend         &     0.381     &  0.973          &    0.65                      &   0.973          & 0.65                      \\
        %\hline
        Edge         &     0.381     &  0.973          &    0.65                      &   0.973          & 0.65                      \\
        %\hline
        Drift 2      &     0.631     &  0.973          &    0.65                      &   0.973          & 0.65                      \\
        \hline
        \end{tabular}
\end{table}
\begin{figure}[htbp]
 \centering
     \includegraphics[width=0.5\textwidth-1cm, keepaspectratio=true]{figures/Benchmarks/T3D_Tra_SBEND_edge_emi.pdf}
    \caption{Emittance comparison between TRACE and TRANSPORT}
    \label{fig:T3D_Tra_emi}
\end{figure}

\subsubsection{From TRACE 3D to TRANSPORT}
\label{ssec:T3DtoTRAN}

\begin{table}[!ht]
\centering
\caption{Bending magnet features in TRACE 3D and TRANSPORT}
\label{tab:Bend_Trace_Tra2}
     \begin{tabular}{|l|l|l|}
        \hline
        \tabhead{Parameter         & Trace 3D              & Transport}
        \hline
        \textbf{Bend card}         & 8                     & 4                        \\
        Angle                      & Input parameter [deg] & Output information [deg] \\
        Magn. field                & Calculated. [T]       & Input parameter [kG]     \\
        Radius of curv.            & Input parameter [mm]  & Output information [m]   \\
        Field-index                & Input parameter       & Input parameter          \\
        Effect. length             & Calculated [mm]       & Input parameter [m]      \\
        \hline
        \hline
        \textbf{Edge card}         & 9                     & 2                        \\
        Edge angle                 & Input parameter [deg] & Input parameter [deg]    \\
        \hline
        \hline
        \textbf{Vertical gap}      & 9                     & 16.5                     \\
        Gap                        & Total [mm]            & Half-gap [cm]            \\
        \hline
        \hline
        \textbf{Fringe field card} & 9                     & 16.7 / 16.8              \\
        $K_1$                      & Default: 0.45         & Default: 0.5             \\
        $K_2$                      & Default: 2.8          & Default: 0               \\
        \hline
        \hline
        \textbf{Bend direction}    & Bend angle sign       & Coord. rotation          \\
        Horiz. right               & Angle $>$ 0           & Angle $>$ 0              \\
        Horiz. left                & Angle $<$ 0           & Card 20                  \\
        Vertical bend              & Card 8, vf $>$ 0      & Card 20                  \\
        \hline
        \end{tabular}
\end{table}

\clearpage
%----------------------------------------------------------------------------------------
376
%    SECTION: \textit{OPAL}
snuverink_j's avatar
snuverink_j committed
377 378
%----------------------------------------------------------------------------------------

379
\subsection{Relations to \textit{OPAL-t}}
snuverink_j's avatar
snuverink_j committed
380 381
\label{sec:OPAL}

382
In \textit{OPAL}, the beam dynamics approach (time integration) is hence completely different from the envelope-like supported by TRACE 3D and TRANSPORT. The three codes support different units and require diverse parameters for the input beam. A summary of their main features is reported in Table~\ref{Features}.
snuverink_j's avatar
snuverink_j committed
383 384 385

\begin{table}[htbp]
    \centering
386
\caption{Main features of the three beam dynamics codes: TRACE 3D, TRANSPORT and \textit{OPAL}}
snuverink_j's avatar
snuverink_j committed
387 388 389
\label{tab:Features}
        \begin{tabular}{|l|l|l|l|}
        \hline
390
        \tabhead{Code  & TRACE 3D          & TRANSPORT          & \textit{OPAL}}
snuverink_j's avatar
snuverink_j committed
391 392 393 394 395 396 397 398 399 400
        \hline
        \textbf{Type}  & Envelope          & Envelope           & Time integration \\
        %\hline
        \textbf{Input} & Twiss, Emittance  & Sigma, Momentum    & Sigma, Energy    \\
        %\hline
        \textbf{Units} & mm-mrad, deg-keV  & cm-rad, cm-\%      & m-$\beta\gamma$  \\
        \hline
\end{tabular}
\end{table}

401
\subsection{\textit{OPAL-t} Units}
snuverink_j's avatar
snuverink_j committed
402 403
\label{ssec:OPAL_units}

404
\textit{OPAL-t} supports the following internal coordinates and units for the three phase planes:
snuverink_j's avatar
snuverink_j committed
405 406 407 408 409 410 411 412 413 414 415 416 417 418 419

\begin{itemize}
\item \textbf{horizontal plane:} \\
X [m] horizontal position of a particle relative to the axis of the element;\\
PX [$\beta_x\gamma$] horizontal canonical momentum;

\item \textbf{vertical plane:}\\
Y [m] vertical position of a particle relative to the axis of the element;\\
PY [$\beta_y\gamma$] horizontal canonical momentum;

\item \textbf{longitudinal plane:}\\
Z [m] longitudinal position of a particle in floor-coordinates;\\
PZ [$\beta_z\gamma$] longitudinal canonical momentum;
\end{itemize}

420
\subsection{\textit{OPAL-t} Input beam}
snuverink_j's avatar
snuverink_j committed
421 422 423 424 425 426 427
\label{ssec:OPAL_input}

For the input beam, a \texttt{GAUSS} distribution type has been chosen.  For transferring the TRANSPORT (or TRACE 3D) input beam in terms of sigma-matrix coefficients, it necessary to:

\begin{itemize}
\item  adjust the units: from mm to m;
\item correct for the factor $\sqrt{5}$: from total to RMS distribution;
snuverink_j's avatar
snuverink_j committed
428
\item multiply for the relativistic factor $\beta\gamma ={0.1224}$ for {7}{MeV} protons;
snuverink_j's avatar
snuverink_j committed
429 430
\end{itemize}

431
 In case of the modified sigma-matrix in Figure~\ref{TRACE_z_Input}, the corresponding \textit{OPAL} parameters for the \texttt{GAUSS} distributions are:
snuverink_j's avatar
snuverink_j committed
432

snuverink_j's avatar
snuverink_j committed
433
\begin{verbatim}
snuverink_j's avatar
snuverink_j committed
434 435 436 437 438 439 440 441
 T3D SIGMA                        OPAL -T
-------------------------------------------------------
1.7088 mm             SIGMAX  = 1.7088/sqrt(5)e-3         m
0.4272 mrad           SIGMAPX = 0.4272/sqrt(5)*0.1224e-3
1.7088 mm             SIGMAY  = 1.7088/sqrt(5)e-3        m
0.4272 mrad           SIGMAPY = 0.4272/sqrt(5)*0.1224e-3
0.1092 mm             SIGMAZ  = 0.1092/sqrt(5)e-3        m
0.0717 %              SIGMAPZ = (0.0717*10)/sqrt(5)*0.1224e-3
snuverink_j's avatar
snuverink_j committed
442
\end{verbatim}
snuverink_j's avatar
snuverink_j committed
443

444
At the end of this calculation, the input beam in \textit{OPAL} is:
snuverink_j's avatar
snuverink_j committed
445

snuverink_j's avatar
snuverink_j committed
446
\begin{verbatim}
snuverink_j's avatar
snuverink_j committed
447 448 449 450 451
D1: DISTRIBUTION, TYPE=GAUSS,
SIGMAX = 0.7642e-03,  SIGMAPX= 0.0234e-03,  CORRX= 0.0,
SIGMAY = 0.7642e-03,  SIGMAPY= 0.0234e-03,  CORRY= 0.0,
SIGMAZ = 0.0488e-03,  SIGMAPZ= 0.0392e-03,  CORRZ= 0.0, R61= 0.0,
INPUTMOUNITS=NONE;
snuverink_j's avatar
snuverink_j committed
452
\end{verbatim}
snuverink_j's avatar
snuverink_j committed
453 454 455 456 457

%----------------------------------------------------------------------------------------
%    SECTION: Comparison TRACE 3D and OPAL
%----------------------------------------------------------------------------------------

458
\subsection{Comparison TRACE 3D and \textit{OPAL-t}}
snuverink_j's avatar
snuverink_j committed
459 460
\label{sec:T3D_OPAL}

461
In this section, the comparison between TRACE 3D and \textit{OPAL-t} is discussed starting from \texttt{SBEND} definition in \textit{OPAL-t}. The transport line described in Section~\ref{T3D_TRAN} has been simulated in \textit{OPAL} using 10.000 particles and $10^{-11}$ s time step. The bending magnet features of Table~\ref{Bend_Trace,Edge_Trace} have been transformed in \textit{OPAL} language as:
snuverink_j's avatar
snuverink_j committed
462

snuverink_j's avatar
snuverink_j committed
463
\begin{verbatim}
snuverink_j's avatar
snuverink_j committed
464 465 466 467 468 469 470 471
Bend: SBEND, ANGLE = 30.0 * Pi/180.0,
             K1=0.0,
             E1=0, E2=0,
             FMAPFN = "1DPROFILE1-DEFAULT",
             ELEMEDGE = 0.250,  // end of first drift
             DESIGNENERGY = 7E+06,  // ref energy eV
             L = 0.1294,
             GAP = 0.02;
snuverink_j's avatar
snuverink_j committed
472
\end{verbatim}
snuverink_j's avatar
snuverink_j committed
473 474 475 476 477

\begin{itemize}

\item \textbf{SBEND without edge angles:}

snuverink_j's avatar
snuverink_j committed
478
\begin{verbatim}
snuverink_j's avatar
snuverink_j committed
479 480 481
// Bending magnet configuration:
K1=0.0,
E1=0, E2=0,
snuverink_j's avatar
snuverink_j committed
482
\end{verbatim}
snuverink_j's avatar
snuverink_j committed
483 484 485 486 487 488

\begin{figure}[htbp]
\begin{center}
    \subfloat[Transverse beam size]{\includegraphics[width=0.5\textwidth-1cm, keepaspectratio=true]{figures/Benchmarks/SBEND_noEdge_Env}}
    \hspace{1.8cm}
    \subfloat[Transverse emittance]{\includegraphics[width=0.5\textwidth-1cm, keepaspectratio=true]{figures/Benchmarks/SBEND_noEdge_Emi}}
489
    \caption{TRACE 13D and \textit{OPAL} comparison: SBEND without edge angles}
snuverink_j's avatar
snuverink_j committed
490 491 492 493 494 495 496 497
    \label{fig:SBEND_noEdge}
\end{center}
 \end{figure}

A good overall agreement has been found between the two codes in term of beam size and emittance. The different behavior inside the bending magnet for the horizontal emittance is still undergoing study and it's probably due to a diverse coordinate system in the two codes.

\item \textbf{SBEND with edge angles:}

snuverink_j's avatar
snuverink_j committed
498
\begin{verbatim}
snuverink_j's avatar
snuverink_j committed
499 500 501
// Bending magnet configuration:
K1=0.0,
E1=10*Pi/180.0, E2=5* Pi/180.0,
snuverink_j's avatar
snuverink_j committed
502
\end{verbatim}
snuverink_j's avatar
snuverink_j committed
503 504 505 506 507 508 509


\begin{figure}[htbp]
\begin{center}
    \subfloat[Transverse beam size]{\includegraphics[width=0.5\textwidth-1cm, keepaspectratio=true]{figures/Benchmarks/SBEND_Edges_Env.pdf}}
    \hspace{1.8cm}
    \subfloat[Transverse RMS emittance]{\includegraphics[width=0.5\textwidth-1cm, keepaspectratio=true]{figures/Benchmarks/SBEND_Edges_Emi.pdf}}
510
    \caption{TRACE 3D and \textit{OPAL} comparison: SBEND with edge angles}
snuverink_j's avatar
snuverink_j committed
511 512 513 514 515 516 517 518 519 520 521
    \label{fig:SBEND_Edges}
\end{center}
 \end{figure}

Even in this case, a good overall agreement has been found between the two codes in term of beam size and emittance.

\item \textbf{SBEND with field index:}

The field index parameter K1 is defined as:

\begin{equation}
snuverink_j's avatar
snuverink_j committed
522
K1 = \frac{1}{B\rho}\frac{\partial B_y}{\partial x},
snuverink_j's avatar
snuverink_j committed
523 524
\end{equation}

snuverink_j's avatar
snuverink_j committed
525
Section~\ref{RBend}. Instead, in TRACE 3D the field index parameter n is:
snuverink_j's avatar
snuverink_j committed
526 527

\begin{equation}
snuverink_j's avatar
snuverink_j committed
528
n = -\frac{\rho}{B_y}\frac{\partial B_y}{\partial x}.
snuverink_j's avatar
snuverink_j committed
529 530
\end{equation}

531
In order to have a significant focusing effect on both transverse planes, the transport line has been simulated in TRACE 3D using $n = 1.5$. Since, a different definition exists between \textit{OPAL} and TRACE 3D on the field index, the n-parameter translation in \textit{OPAL} language has been done with the following tests:
snuverink_j's avatar
snuverink_j committed
532 533 534 535 536 537 538

\begin{itemize}[noitemsep]
\item[] TEST 1: K1 $=$ n/$\rho^2$
\item[] TEST 2: K1 $=$ n
\item[] TEST 3: K1 $=$ n/$\rho$
\end{itemize}

snuverink_j's avatar
snuverink_j committed
539
Only the TEST 2 reports a reasonable behavior on the beam size and emittance, as shown in Figure~\ref{SBEND_FI} using:
snuverink_j's avatar
snuverink_j committed
540

snuverink_j's avatar
snuverink_j committed
541
\begin{verbatim}
snuverink_j's avatar
snuverink_j committed
542 543 544
// Bending magnet configuration:
K1=1.5
E1=0, E2=0,
snuverink_j's avatar
snuverink_j committed
545
\end{verbatim}
snuverink_j's avatar
snuverink_j committed
546 547 548 549 550 551

\begin{figure}[htbp]
\begin{center}
    \subfloat[Transverse beam size]{\includegraphics[width=0.5\textwidth-1cm, keepaspectratio=true]{figures/Benchmarks/FI_SBEND_FMDef_Env_T2.pdf}}
    \hspace{1.8cm}
    \subfloat[Transverse RMS emittance]{\includegraphics[width=0.5\textwidth-1cm, keepaspectratio=true]{figures/Benchmarks/FI_SBEND_FMDef_Emi_T2.pdf}}
552
    \caption{TRACE 3D and \textit{OPAL} comparison: SBEND with field index and default field map}
snuverink_j's avatar
snuverink_j committed
553 554 555 556
    \label{fig:SBEND_FI}
\end{center}
 \end{figure}

557
Concerning the emittances and vertical beam size, a perfect agreement has been found, instead a defocusing effect appears in the horizontal plane. These results have been obtained with the default field map provided by \textit{OPAL}. However, a better result, only in the beam size as shown in Figure~\ref{SBEND_FI_test}, is achieved using a test field map in which the fringe field extension has been changed in the thin lens approximation.
snuverink_j's avatar
snuverink_j committed
558 559 560 561 562 563

\begin{figure}[htbp]
\begin{center}
    \subfloat[Transverse beam size]{\includegraphics[width=0.5\textwidth-1cm, keepaspectratio=true]{figures/Benchmarks/FI_SBEND_FMTest_Env_T2.pdf}}
    \hspace{1.8cm}
    \subfloat[Transverse RMS emittance]{\includegraphics[width=0.5\textwidth-1cm, keepaspectratio=true]{figures/Benchmarks/FI_SBEND_FMTest_Emit_T2.pdf}}
564
    \caption{TRACE 3D and \textit{OPAL} comparison: SBEND with field index and test field map}
snuverink_j's avatar
snuverink_j committed
565 566 567 568 569
    \label{fig:SBEND_FI_test}
 \end{center}
 \end{figure}
\end{itemize}

570
\subsubsection{From TRACE 3D to \textit{OPAL-t}}
snuverink_j's avatar
snuverink_j committed
571 572 573 574
\label{ssec:T3DtoOPAL}

\begin{table}[!ht]
\centering
575
\caption{Bending magnet features in TRACE 3D and \textit{OPAL-t}}
snuverink_j's avatar
snuverink_j committed
576 577 578
\label{tab:Bend_Trace_OPAL}
     \begin{tabular}{|l|l|l|}
        \hline
579
        \tabhead{Parameter         & Trace 3D              & \textit{OPAL-t}}
snuverink_j's avatar
snuverink_j committed
580
        \hline
snuverink_j's avatar
snuverink_j committed
581
        \textbf{Bend card}         & 8                     & \texttt{SBEND} or \texttt{RBEND} \\
snuverink_j's avatar
snuverink_j committed
582 583 584 585 586 587 588 589
        Angle                      & Input parameter [deg] & Input/Calc. parameter [rad]        \\
        Magn. field                & Calculated. [T]       & Input/Calc  parameter [T]          \\
        Radius of curv.            & Input parameter [mm]  & Output information [m]             \\
        Field-index                & Input parameter       & Input parameter                    \\
        Length                     & Calculated [mm]       & Input/Calc parameter [m]           \\
        Length type                & Effective             & Straight                           \\
        \hline
        \hline
snuverink_j's avatar
snuverink_j committed
590
        \textbf{Edge card}         & 9                     & \texttt{SBEND} or \texttt{RBEND} \\
snuverink_j's avatar
snuverink_j committed
591 592 593
        Edge angle                 & Input parameter [deg] & Input parameter [rad]              \\
        \hline
        \hline
snuverink_j's avatar
snuverink_j committed
594
        \textbf{Vertical gap}      & 9                     & \texttt{SBEND} or \texttt{RBEND} \\
snuverink_j's avatar
snuverink_j committed
595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625
        Gap                        & Total [mm]            & Total [m]                          \\
        \hline
        \hline
        \textbf{Fringe field card} & 9                     & FIELD MAP                          \\
        $K_1$                      & Default: 0.45         & -                                  \\
        $K_2$                      & Default: 2.8          & -                                  \\
        \hline
        \hline
        \textbf{Bend direction}    & Bend angle sign       & Coord. rotation                    \\
        Horiz. right               & Angle $>$ 0           & Angle $>$ 0                        \\
        Horiz. left                & Angle $<$ 0           & Angle $<$ 0                        \\
        Vertical bend              & Card 8, vf $>$ 0      & Coord. rotation                    \\
        \hline
        \end{tabular}
\end{table}

\clearpage

%----------------------------------------------------------------------------------------
% Conclusion
%----------------------------------------------------------------------------------------

\subsection{Conclusion}
\label{sec:conclusion}

\begin{itemize}

\item \textbf{TRACE 3D and TRANSPORT:} \\
- a perfect agreement has been found between these two codes in transversal envelope and emittance; \\
- changing the TRANSPORT units, the input beam parameters, in terms of sigma-matrix coefficients, can directly be imported from TRACE 3D file.

626
\item \textbf{TRACE 3D and \textit{OPAL-t}:} \\
snuverink_j's avatar
snuverink_j committed
627 628 629
- a good agreement has been found between these two codes in case of sector bending magnet with and without edge angles;\\
% ADA  the field index definition should be clarified according to the results of TEST1, TEST2 and TEST3; \\
- the default magnetic field map seems not working properly if the field index is not zero\\
snuverink_j's avatar
snuverink_j committed
630
- an improvement of the test map used is needed in order to match the TRACE 3D emittance see~Figure~\ref{SBEND_FI_test}.
snuverink_j's avatar
snuverink_j committed
631 632 633 634 635
\end{itemize}


\section{Hard Edge Dipole Comparison with ELEGANT}

636 637
\subsection{\textit{OPAL} Dipole}
When defining a dipole (\texttt{SBEND} or \texttt{RBEND}) in \textit{OPAL},  a fringe field map which defines the range of the field and the Enge coefficients is required. If no map is provided, the code uses a default map. Here is a dipole definition using the default map:
snuverink_j's avatar
snuverink_j committed
638 639 640

\begin{description}
\item[Example:]
snuverink_j's avatar
snuverink_j committed
641
\item \begin{verbatim}
snuverink_j's avatar
snuverink_j committed
642 643 644 645 646 647 648
      bend1: SBEND, ANGLE = bend_angle,
      E1 = 0, E2 = 0,
      FMAPFN = "1DPROFILE1-DEFAULT",
      ELEMEDGE = drift_before_bend,
      DESIGNENERGY = bend_energy,
      L = bend_length,
      WAKEF = FS_CSR_WAKE;
snuverink_j's avatar
snuverink_j committed
649
      \end{verbatim}
snuverink_j's avatar
snuverink_j committed
650
\end{description}
651
Please refer to Section~\ref{1DProfile1} for the definition of the field map and the default map \texttt{1DPROFILE1-DEFAULT}. It defines a fringe field that extends to 10 cm away from a dipole edge in both directions and it has both $B_y$ and $B_z$ components. This makes the comparison between \textit{OPAL} and other codes which uses a hard edge dipole by default,cumbersome because one needs to carefully integrate thought the fringe field region in \textit{OPAL} in order to come up with the integrated fringe field value (FINT in ELEGANT) that usually used by these codes, e.g. the ELEGANT and the TRACE3D. So we need to find a default map for the hard edge dipole in \textit{OPAL}.
snuverink_j's avatar
snuverink_j committed
652 653 654 655 656

\subsection{Map for Hard Edge Dipole}
The proposed default map for a hard edge dipole can be:
\begin{description}
\item
snuverink_j's avatar
snuverink_j committed
657
\begin{verbatim}
snuverink_j's avatar
snuverink_j committed
658 659 660 661 662
1DProfile1  0  0  2
-0.00000001 0.0 0.00000001 3
-0.00000001 0.0 0.00000001 3
-99.9
-99.9
snuverink_j's avatar
snuverink_j committed
663
\end{verbatim}
snuverink_j's avatar
snuverink_j committed
664 665 666 667 668
\end{description}
On the first line, the two zeros following  \texttt{1DProfile1} are the orders of the Enge coefficient for the entrance and exit edge of the dipole. $2 cm$ is the default dipole gap width. The second line defines the fringe field region of the entrance edge of the dipole which extends from $-0.00000001 cm$ to $0.00000001 cm$.  The third line defines the same fringe field region for the exit edge of the dipole. The $3$s on both line don't mean anything, they are just placeholders. On the fourth and fifth line, the zeroth order Enge coefficients for both edges are given. Since they are large negative numbers, the field in the fringe field region has no $B_z$ component and its $B_y$ component is just like the field in the middle of the dipole.
\begin{figure}[!htbp]
\centering
\includegraphics[height=0.5\textwidth-0.6cm, angle = -90, trim = 8mm 10mm 2mm 10mm, clip]{figures/Benchmarks/report-compare-default}
669
\caption{Compare emittances and beam sizes obtained by using the hard edge map (\textit{OPAL}), the default map (\textit{OPAL}), and the ELEGANT}
snuverink_j's avatar
snuverink_j committed
670 671
\label{fig:plot-compare-default}
\end{figure}
snuverink_j's avatar
snuverink_j committed
672
Figure~\ref{plot-compare-default} compares the emittances and beam sizes obtained by using the hard edge map, the default map and the ELEGANT. One can see that the results produced by the hard edge map match the ELEGANT results when FINT is set to zero.
snuverink_j's avatar
snuverink_j committed
673 674

\subsection{Integration Time Step}
snuverink_j's avatar
snuverink_j committed
675
When the hard edge map is used for a dipole, finer integration time step is needed to ensure the accurate of the calculation. Figure~\ref{plot-emit-dt} compares the normalized emittances generated using the hard edge map in \textit{OPAL} with varying time steps to those from the ELEGANT. {0.01}{ps} seems to be a optimal time step for the fringe field region. To speed up the simulations, one can use larger time steps outside the fringe field regions. In Figure~\ref{plot-emit-dt}, one can observe a discontinuity in the horizontal emittance when the hard edge map is used in the calculation. This discontinuity comes from the fact that \textit{OPAL} emittance is calculated at an instant time. Once the beam or part of the beam gets into the dipole, its $P_x$ gets a kick which will result in a sudden emittance change.
snuverink_j's avatar
snuverink_j committed
676 677 678 679 680 681 682 683 684
\begin{figure}[!htbp]
\centering
\includegraphics[width=0.5\textwidth,
angle = -90,
trim = 0mm 20mm 0mm 8mm, clip]{figures/Benchmarks/report-emit-dt}
\caption{Horizontal and vertical normalized emittances for different integration time steps}
\label{fig:plot-emit-dt}
\end{figure}

snuverink_j's avatar
snuverink_j committed
685
Figure~\ref{plot-fringe-size,plot-fringe-size-zoom} examine the effects of the fringe field range and the integration time step on the simulation accuracy. Figure~\ref{plot-fringe-size-zoom} is a zoom-in plot of Figure~\ref{plot-fringe-size}. We can conclude that the size of the integration time step has more influence on the accuracy of the simulation.
snuverink_j's avatar
snuverink_j committed
686 687 688 689 690 691 692 693 694
\begin{figure}[!htbp]
\centering
\includegraphics[height=0.5\textwidth-0.6cm, angle = -90, trim = 3mm 0mm 2mm 0mm, clip]{figures/Benchmarks/report-fringe-size}
\caption{Normalized horizontal emittance for different fringe field ranges and integration time steps}
\label{fig:plot-fringe-size}
\end{figure}
\begin{figure}[!htbp]
\centering
\includegraphics[height=0.5\textwidth-0.6cm, angle = -90, trim = 3mm 0mm 2mm 0mm, clip]{figures/Benchmarks/report-fringe-size-zoom}
snuverink_j's avatar
snuverink_j committed
695
\caption{Zoom in on the final emittance in Figure~\ref{plot-fringe-size-zoom}}
snuverink_j's avatar
snuverink_j committed
696 697 698 699
\label{fig:plot-fringe-size-zoom}
\end{figure}

\section{1D CSR comparison with ELEGANT}
snuverink_j's avatar
snuverink_j committed
700
1D-CSR wake function can now be used for the drift element by defining its attribute \texttt{WAKEF = FS\_CSR\_WAKE}. In order to calculate the CSR effect correctly, the drift has to follow a bending magnet whose CSR calculation is also turned on.
snuverink_j's avatar
snuverink_j committed
701 702 703

\begin{description}
\item[Example:]
snuverink_j's avatar
snuverink_j committed
704
\item \begin{verbatim}
snuverink_j's avatar
snuverink_j committed
705 706 707 708 709 710 711
      bend1: SBEND, ANGLE = bend_angle,
      E1 = 0, E2 = 0,
      FMAPFN = ``1DPROFILE1-DEFAULT'',
      ELEMEDGE = drift_before_bend,
      DESIGNENERGY = bend_energy,
      L = bend_length,
      WAKEF = FS_CSR_WAKE;
snuverink_j's avatar
snuverink_j committed
712 713
      \end{verbatim}
\item  \begin{verbatim}
snuverink_j's avatar
snuverink_j committed
714 715
       drift1: DRIFT, L=0.4, ELEMEDGE = drift_before_bend +
       bend_length, WAKEF = FS_CSR_WAKE;
snuverink_j's avatar
snuverink_j committed
716
       \end{verbatim}
snuverink_j's avatar
snuverink_j committed
717 718 719
\end{description}

\subsection{Benchmark}
snuverink_j's avatar
snuverink_j committed
720
The \textit{OPAL} dipoles all have fringe fields. When comparisons are done between \textit{OPAL} and ELEGANT \ref{elegant} for example, one needs to appropriately set the FINT attribute of the bending magnet in ELEGANT in order to represent the field correctly. Although ELEGANT tracks in the ($x, x', y, y', s, \delta$) phase space, where $\delta = \frac{\Delta p}{p_0}$ and $p_0$ is the momentum of the reference particle, the watch point output beam distributions from the ELEGANT are list in ($x, x', y, y', t, \beta\gamma$). If one wants to compare ELEGANT watch point output distribution to \textit{OPAL}, unit conversion needs to be performed, i.e.
snuverink_j's avatar
snuverink_j committed
721 722 723 724 725
\begin{eqnarray*}
P_x &=& x'\beta\gamma, \\ P_y &=& y'\beta\gamma, \\ s &=& (\bar t-t)\beta c .
\end{eqnarray*}


726
To benchmark the CSR effect, we set up a simple beamline with 0.1m drift $+$ 30 degree sbend $+$ 0.4m drift. When the CSR effect is turn off, Figure~\ref{plot-emit-csr-off} shows that the normalized emittances calculated using both \textit{OPAL} and ELEGANT agree. The emittance values from \textit{OPAL} are obtained from the {\it .stat} file, while for ELEGANT, the transverse emittances are obtained from the sigma output file (enx, and eny), the longitudinal emittance is calculated using the watch point beam distribution output.
snuverink_j's avatar
snuverink_j committed
727 728 729
\begin{figure}[!htbp]
\centering
\includegraphics[height=0.5\textwidth-0.6cm, angle = -90, trim = 3mm 0mm 2mm 0mm, clip]{figures/Benchmarks/emit-csr-off}
730
\caption{Comparison of the trace space using ELEGANT and \textit{OPAL}}
snuverink_j's avatar
snuverink_j committed
731 732 733
\label{fig:plot-emit-csr-off}
\end{figure}

734
When CSR calculations are enabled for both the bending magnet and the following drift, Figure~\ref{plot-dpp-csr-on} shows the average $\delta$ or $\frac{\Delta p}{p}$ change along the beam line, and Figure~\ref{plot-emit-csr-on} compares the normalized transverse and longitudinal emittances obtained by these two codes. The average $\frac{\Delta p}{p}$ can be found in the centroid output file (Cdelta) from ELEGANT, while in \textit{OPAL}, one can calculate it using $\frac{\Delta p}{p} = \frac{1}{\beta^2}\frac{\Delta \overline{E}}{\overline{E}+mc^2}$, where $\Delta \overline{E}$ is the average kinetic energy from the {\it .stat} output file.
snuverink_j's avatar
snuverink_j committed
735 736 737
\begin{figure}[!htbp]
\centering
\includegraphics[height=0.5\textwidth-0.6cm, angle = -90, trim = 3mm 0mm 2mm 0mm, clip]{figures/Benchmarks/dpp-csr-on}
738
\caption{$\frac{\Delta p}{p}$ in Elegant and \textit{OPAL}}
snuverink_j's avatar
snuverink_j committed
739 740
\label{fig:plot-dpp-csr-on}
\end{figure}
snuverink_j's avatar
snuverink_j committed
741
In the drift space following the bending magnet, the CSR effects are calculated using Stupakov's algorithm with the same setting in both codes. The average fractional momentum change $\frac{\Delta p}{p}$ and the longitudinal emittance show good agreements between these codes. However, they produce different horizontal emittances as indicated in Figure~\ref{plot-emit-csr-on}.
snuverink_j's avatar
snuverink_j committed
742 743 744
\begin{figure}[!htbp]
\centering
\includegraphics[height=0.5\textwidth-0.6cm, angle = -90, trim = 3mm 0mm 2mm 0mm, clip]{figures/Benchmarks/emit-csr-on}
745
\caption{Transverse emittances in ELEGANT and \textit{OPAL}}
snuverink_j's avatar
snuverink_j committed
746 747 748
\label{fig:plot-emit-csr-on}
\end{figure}

snuverink_j's avatar
snuverink_j committed
749
One important effect to notice is that in the drift space following the bending magnet, the normalized emittance $\epsilon_x(x, P_x)$ output by \textit{OPAL} keeps increasing while the trace-like emittance $\epsilon_x(x, x')$ calculated by ELEGANT does not. This can be explained by the fact that with a relatively large energy spread (about $3\%$ at the end of the dipole due to CSR), {\bf an correlation} between transverse position and energy can build up in a drift thereby induce emittance growth. However, this effect can only be observed in the normalized emittance calculated with $\epsilon_x(x, P_x) = \sqrt{\langle x^2 \rangle \langle P_x^2\rangle - \langle xP_x \rangle^2}$ where $P_x = \beta\gamma x'$, not the trace-like emittance which is calculated as $\epsilon_x(x, x') = \beta\gamma\sqrt{\langle x^2 \rangle \langle x'^2 \rangle - \langle xx' \rangle^2}$ \ref{prstab2003}. In Figure~\ref{plot-emit-csr-on}, a trace-like horizontal emittance is also calcualted for the \textit{OPAL} output beam distributions. Like the ELEGANT result, this trace-like emittance doesn't grow in the drift. However, their differences come from the ELEGANT's lack of CSR effect in the fringe field region.
snuverink_j's avatar
snuverink_j committed
750

751
\section{\textit{OPAL} \& \texttt{Impact-t}}
snuverink_j's avatar
snuverink_j committed
752
This benchmark compares rms quantities such as beam size and emittance of \textit{OPAL} and \texttt{Impact-t} \ref{qiang2005, qiang2006-1, qiang2006-2}. A {\bf cold} {10}{mA} H+ bunch is expanding in a {1}{m} drift space. A Gaussian distribution, with a cut at 4 $\sigma$ is used. The charge is computed by assuming a {1}{MHz} structure i.e. $Q_{\text{tot}}=\frac{I}{\nu_{\text{rf}}}$. For the simulation we use a grid with $16^{3}$ grid point and open boundary condition. The number of macro
snuverink_j's avatar
snuverink_j committed
753 754
particles is $N_{\text{p}} = 10^{5}$.

755
\subsection{\textit{OPAL} Input}
snuverink_j's avatar
snuverink_j committed
756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795
\begin{longexample}
OPTION, ECHO = FALSE, PSDUMPFREQ = 10,
STATDUMPFREQ = 10, REPARTFREQ = 1000,
PSDUMPLOCALFRAME = FALSE, VERSION=10600;

TITLE, string="Gaussian bunch drift test";

REAL Edes    = 0.001;        // GeV
REAL CURRENT = 0.01;  // A

REAL gamma=(Edes+PMASS)/PMASS;
REAL beta=sqrt(1-(1/gamma^2));
REAL gambet=gamma*beta;
REAL P0 = gamma*beta*PMASS;

D1: DRIFT, ELEMEDGE = 0.0, L = 1.0;

L1: LINE = (D1);

Fs1: FIELDSOLVER, FSTYPE = FFT, MX = 16, MY = 16, MT = 16, BBOXINCR=0.1;

Dist1: DISTRIBUTION, TYPE = GAUSS,
       OFFSETX = 0.0, OFFSETY = 0.0, OFFSETZ = 15.0e-3,
       SIGMAX = 5.0e-3, SIGMAY = 5.0e-3, SIGMAZ = 5.0e-3,
       OFFSETPX = 0.0, OFFSETPY = 0.0, OFFSETPZ = 0.0,
       SIGMAPX = 0.0 , SIGMAPY = 0.0 , SIGMAPZ = 0.0 ,
       CORRX = 0.0, CORRY = 0.0, CORRZ = 0.0,
       CUTOFFX = 4.0, CUTOFFY = 4.0, CUTOFFLONG = 4.0;

Beam1: BEAM, PARTICLE = PROTON, CHARGE = 1.0, BFREQ = 1.0, PC = P0,
               NPART = 1E5, BCURRENT = CURRENT, FIELDSOLVER = Fs1;

SELECT, LINE = L1;

TRACK, LINE = L1, BEAM = Beam1, MAXSTEPS = 1000, ZSTOP = 1.0, DT = 1.0e-10;
 RUN, METHOD = "PARALLEL-T", BEAM = Beam1, FIELDSOLVER = Fs1, DISTRIBUTION = Dist1;
ENDTRACK;
STOP;
\end{longexample}

snuverink_j's avatar
snuverink_j committed
796
\subsection{\texttt{Impact-t} Input}
snuverink_j's avatar
snuverink_j committed
797
\begin{longexample}
snuverink_j's avatar
snuverink_j committed
798
!Welcome to \texttt{Impact-t} input file.
snuverink_j's avatar
snuverink_j committed
799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856
!All comment lines start with "!" as the first character of the line.
! col row
1 1
!
! information needed by the integrator:
! step-size, number of steps, and number of bunches/bins (??)
!
!   dt    Ntstep  Nbunch
1.0e-10   700     1
!
! phase-space dimension, number of particles, a series of flags
! that set the type of integrator, error study, diagnostics, and
! image charge, and the cutoff distance for the image charge
!
! PSdim  Nptcl   integF  errF  diagF  imchgF  imgCutOff (m)
6 100000  1 0 1 0 0.016
!
! information about mesh: number of points in x, y, and z, type
! of boundary conditions, transverse aperture size (m),
! and longitudinal domain size (m)
!
!  Nx  Ny  Nz  bcF   Rx    Ry    Lz
16 16 16 1 0.15 0.15 1.0e5
!
!
! distribution type number (2 == Gauss), restart flag, space-charge substep
! flag, number of emission steps, and max emission time
!
! distType  restartF  substepF  Nemission  Temission
2           0         0         -1          0.0
!
!  sig*   sigp*  mu*p*  *scale  p*scale  xmu*      xmu*
!
0.005 0.0 0.0  1. 1. 0.0 0.0
0.005 0.0 0.0  1. 1. 0.0 0.0
0.005 0.0 0.0  1. 1. 0.0 0.0462
!
! information about the beam: current, kinetic energy, particle
! rest energy, particle charge, scale frequency, and initial cavity phase
!
! I/A   Ek/eV     Mc2/eV          Q/e  freq/Hz  phs/rad
0.010   1.0e6     938.271998e+06  1.0  1.0e6      0.0
!
!
! ======= machine description starts here =======
! the following lines, which must each be terminated with a '/',
! describe one beam-line element per line; the basic structure is
! element length, ???, ???, element type, and then a sequence of
! at most 24 numbers describing the element properties
!   0  drift tube    2      zedge radius
!   1  quadrupole    9      zedge, quad grad, fileID,
!                             radius, alignment error x, y
!                             rotation error x, y, z
! L/m  N/A N/A  type  location of starting edge  v1  <B0><B0><B0>  v23 /
1.0    0   0    0    0.0                           0.5            /
\end{longexample}

\subsection{Results}
snuverink_j's avatar
snuverink_j committed
857
A good agreement is shown in the Figure~\ref{plot-opal-impact1,plot-opal-impact2}. This proves to some extend the compatibility of the
858
space charge solvers of \textit{OPAL} and \texttt{Impact-t}.
snuverink_j's avatar
snuverink_j committed
859 860 861 862 863 864

\begin{figure}[!htbp]
\centering
\includegraphics[width=0.5\textwidth-0.6cm, angle = 0, trim = 20mm 0mm 15mm 0mm, clip]{figures/Benchmarks/opal-impact-1MHz-x}
\hspace{1cm}
\includegraphics[width=0.5\textwidth-0.6cm, angle = 0, trim = 20mm 0mm 15mm 0mm, clip]{figures/Benchmarks/opal-impact-1MHz-y}
865
\caption{Transverse beam sizes and emittances in \texttt{Impact-t} and \textit{OPAL}}
snuverink_j's avatar
snuverink_j committed
866 867 868 869 870 871
\label{fig:plot-opal-impact1}
\end{figure}

\begin{figure}[!htbp]
\centering
\includegraphics[width=0.5\textwidth-0.6cm, angle = 0, trim = 20mm 0mm 15mm 0mm, clip]{figures/Benchmarks/opal-impact-1MHz-z}
872
\caption{Longitudinal beam size and emittance in \texttt{Impact-t} and \textit{OPAL}}
snuverink_j's avatar
snuverink_j committed
873 874 875 876
\label{fig:plot-opal-impact2}
\end{figure}

\input{footer}