Commit 771cb847 authored by Thomas Planche's avatar Thomas Planche

re-organizing tuto files

parent cce4b0f5
Pipeline #6632 canceled with stages
\documentclass[usletter, 11pt]{article}
\DeclareMathAlphabet\mathbfcal{OMS}{cmsy}{b}{n}% for \mathbfcal to work
\usepackage[center, small, sl]{caption}
\usepackage{hyperref}%to include hyper links
basicstyle=\tt\scriptsize ,
columns=fullflexible, %this is to allow simple copy-paste of the code to a zgoubi input file
%morecomment=[l]{!\ }% Comment only with space after !
\usepackage[section]{placeins}% to be able to use \FloatBarrier
\usepackage[capitalise]{cleveref}%to use \cref
\addtolength{\textwidth}{1.5 cm}
\addtolength{\hoffset}{-0.8 cm}
%\addtolength{\topmargin}{-2 cm}
%\addtolength{\textheight}{3. cm}
\title{Zgoubi, would you do for me\\TRIUMF's High Resolution Separator?}
\author{Thomas Planche}
%\footnote{}\\~\\ TRIUMF\thanks{This work has been supported by the Natural Sciences and Engineering Research Council of Canada. TRIUMF also receives federal funding via a contribution agreement through the National Research Council of Canada.}}
\section{Basic Layout}\label{sec:layout}
The optical system we will consider in this tutorial is designed to separate rare isotopes with mass/charge differences of only one part in 20\,000 in beams with transverse emittances of at least 3\,$\mu$m\footnote{Un-normalized emittance. Note that to achieve such resolution an energy spread of the order of 1\,eV or less is required.}~\cite{TRI-DN-16-09}.
It is composed of:
\item a source slit;
\item followed by an 80\,cm drift;
\item followed by two identical 90\,deg.~magnetic dipoles (bending radius~=~120\,cm, edge angle~$\approx$~26.5\,deg.) separated by a 2$\times$80\,cm drift;
\item followed by an 80\,cm drift;
\item followed by an image slit.
\includegraphics*[width=0.8 \linewidth]{figure/marco}
\caption{TRIUMF high resolution separator basic layout (from source slit to image slit).}\label{fig:marco}
The basic parameters of this high resolution separator (HRS) were determined using the linear optics code {\tt TRANSOPTR}~\cite{optrOnGitlab}.
To achieve in practice the desired resolving power, it is essential to compensate non-linear aberration. For this purpose an electrostatic multipole corrector is added halfway between the two dipoles. The detailed design of the most critical components -- the dipoles and the multipole corrector -- was accomplished using a 3D finite element code ({\tt OPERA}) and non-linear optics codes such as {\tt COSY-INFINITY} and {\tt zgoubi}.
In this note I will go through the steps of the design work done using {\tt zgoubi}.
\section{Define your {\tt'OBJECT'}}
Let's start with something simple and try to track one single particle. Let's say we want to track a single 60\,keV $\rm{^{238}U}^+$ ion. At first we will track it through magnetic elements only, so the knowledge of the magnetic rigidity $B\rho$ is sufficient. As a reminder the magnetic rigidity is given by:
where $q$ is the charge of the particle, and $p$ its momentum given by:
where $E$ is the particle's total energy, $m$ its mass, and $c$ the speed of light. For non-relativistic particles, like our 60\,keV uranium ion, the momentum can also be calculated from:
where $V$ is the beam potential (60\,kV in our case).%\footnote{$qV$ is often called `kinetic' energy. It is a true kinetic energy only in the non-relativistic approximation. In the relativistic case the beam potential is given by $(\gamma-1)mc^2$ and cannot be seen as a kinetic energy term, whatever way you look at it~\cite{2014PHYS-1}.}.
If you look into {\tt zgoubi} user's guide~\cite{meot2012zgoubi} you will find you need to call use the keyword {\tt 'OBJECT'} (or {\tt 'OBJET'} if you like to talk to {\tt zgoubi} in French). There are several ways (KOBJ=1 to 6) to have the 'object' you will track be one single particle. Let's try to use KOBJ=2:
zgoubi HRS tuto: DIPOLE !zgoubi requires input files to be given a title on line 1
?? !BORO[]: Brho of 60 keV 238U+ in
2 !KOBJ=2: initial coordinates must be entered explicitly
1 1 !total number of particles; number of distinct momenta
0. 0. 0. 0. 0. 1. 'o' !Y; T; Z; P; S; D; 'marker'. Note: Brho=BORO*D
1 !1 or -9 (-9 disables the tracking of this particle)
{\it Assignment: copy-paste these lines into a text file that will serve as input to {\tt zgoubi}. Replace the red double question mark `{\color{red}??}' by the appropriate value of {\tt BRHO}.}
\section{{\tt 'DIPOLE'}}
\includegraphics*[width=0.7 \linewidth, trim={10 10 10 10}]{figure/Fig9a}
\caption{Parameters used to define the field map and geometrical boundaries, from {\tt zgoubi} user's guide~\cite{meot2012zgoubi}.}\label{fig:DIPOLE}
We will first try to simulate our separator using {\tt zgoubi}'s built-in {\tt 'DIPOLE'} model. \cref{fig:DIPOLE} reproduces a figure from {\tt zgoubi} user's guide~\cite{meot2012zgoubi} that is very useful to understand the input values to {\tt 'DIPOLE'}.
To mimic our separator dipole, we will need to determine the parameters such that the beam is bent 90\,deg.~and passes through the center of the dipole at a radius of 120\,cm. To do that it is convenient to stop the tracking right in the middle of the dipole:
2 !IL= 0 no outpot, = 2 output trajectory to zgoubi.plt, etc.
65 120. !AT[deg.], RM[cm]
65 ?? 0. 0. 0. !ACENT[deg.];B0[kG]; N; B; GX
7.0 0. !ENTRANCE FIELD BOUNDARY: fringe field extend[cm]; unused
0 0. 1.8 0. 0. 0. 0. 0. !unused; C0...C5; shift
45. 26.5 1e99 0.0 0.0 1e99 !W+[deg.]; edge angle[deg.]; R1[cm]; U1; U2; R2[cm]
0. 0. !EXIT FIELD BOUNDARY: (not used yet because tracking stops at AT=65 deg.)
0. 0. 0. 0. 0. 0. 0. 0.
0. 0. -1e99 0.0 0.0 -1e99 0.
0. 0. !FACE 3: (Not used here)
0 0. 0. 0. 0. 0. 0. 0.
0. 0. 0. 0. 0. 0. 0.
2 4. !IRD(=2, 25 or 4)
0.5 !Integration step size[cm]
2 ?? ?? 0. 0. !KPOS RE[cm]; TE[rad]; RS[cm]; TS[rad]
Note that the tracking starts 20\,deg. before the effective edge of the magnet to leave room for the fringe field\footnote{About fringe fields: in most cases it is unimportant to know the precise shape of the field field. For dipoles (and quadrupoles~\cite{baartman1997intrinsic}) the lowest order aberration (second order for dipoles, third order for quads) is practically independent of the details of the fringe field. The next order aberration depends only on the fringe field extend. For more details read Ref.~\cite{baartman2001end}. It is only when you look at quite-high-order aberrations that the shape of the field fall off starts to matter.
For our dipole I chose a fringe field as simple as possible: fringe field extend~=~magnet gap (7\,cm) and a shape defined by a single Enge coefficient: {\tt C1}=1.8 (all the others are set to 0).} to fall off to (practically) zero, which leads to {\tt AT}=90/2+20=65\,degree.
{\it Assignment: copy-paste these lines right bellow the {\tt 'OBJECT'} definition (\cref{list:OBJET}). Guess the values of {\tt B0, RE}, and {\tt TE} such that the particle arrives at the magnet center:
\item bent 45\, deg.;
\item at {\tt Y}=120\,cm (radial coordinate in the local reference frame of {\tt 'DIPOLE'});
\item with {\tt T}=0\,mrad (angle w.r.t.~the reference trajectory).
To check how good your guess was look into the output of {\tt 'FAISCNL'} (in this case: in the file `atDIPOLEcenter.fai'). You can also plot the step-by-step output into zgoubi.plt (triggered by IL=2). If you use {\tt gnuplot}, try something like:}
set xlabel "Theta/deg."
set ylabel "R/cm"
plot "zgoubi.plt" using ($22*180./pi):($10)
\section{{\tt 'FIT'} dipole parameters}
To accurately (and rapidly) determined the values of {\tt B0}, and {\tt RE} we will use the {\tt 'FIT'} keyword. Add this right before the {\tt 'END'} statement:
2 !Number of physical parameters to be varied
2 5 0. 0.2 !element #2; vary parameter #5 (BO); coupling switch; relative range
2 64 0. 0.2 !element #2; vary parameter #64 (RE); coupling switch; relative range
2 1e-8 100 !Number of constraints; Convergence threshold; maximum number of iterations
3 1 2 2 120.0 1. 0 !IC; Particle #; coordinate#=2 for Y;element #; wanted value; weigth ; 0
3 1 3 2 0.0 1. 0 !IC; Particle #; coordinate#=3 for T;element #; wanted value; weigth ; 0
{\it Assignment: Find values {\tt B0}, and {\tt RE} from fit. run {\tt zgoubi} with those fitted values and plot the resulting particle trajectory (from zgoubi.plt). You should get plots like in~\cref{fig:DIPOLEtraj}. }
\includegraphics*[width=1.0 \linewidth, trim={0 40 0 40}]{figure/traj}
\caption{Trajectory output into zgoubi.plt plotted in cylindrical (left) and Cartesian (right) coordinates. }\label{fig:DIPOLEtraj}
Side note: looking for the a parameter number can be sometime quite frustrating, especially for an element like {\tt 'DIPOLE'} that has a large number of input parameters. What works best for me it to look for it by trial-and-error, watching the `INITIAL' value column in {\tt zgoubi}'s console output.
\section{{\tt'MATRIX'} to fit edge angles}
The dipole edge angles are set so that the phase advance from the source slit to the image slit is exactly 180\,deg. (in the horizontal direction). One could fit the transfer matrix coefficient $m_{12}$ and $m_{21}$ to be zero at the image slit. One can also fit the transfer matrix coefficient $m_{11}$ and $m_{22}$ to be zero half-way through the HRS, since the phase advance from the source slit should there be 180/2=90\,degree. I choose to follow the second approach.
{\it Assignment: we have only simulated one half of a magnet so far. Let's set up the other half: in {\tt 'DIPOLE'} set {\tt AT}=65$\times$2=130\,deg., and define the exit face parameters so that the exit face is the mirror image of the entrance face. Be careful with the signs! They are NOT consistent with the standard {\tt TRANSPORT} definition (see~\cref{fig:DIPOLE}) }
Before and after the dipole we should also have 80\,cm drift length (see~\cref{sec:layout}). The thing is that we already have a drift length built into the dipole definition: the 2$\times$20 extra degree we left for the field to fall off. So the drift length we have to add is $80-120\tan(20\,{\rm deg.)}$. So add this before and after your dipole definition:
36.32357 ! drift length=80-120*tan(20/deg.)
Now to we get {\tt zgoubi} to calculate transfer matrix coefficient: use the keyword {\tt 'MATRIX'} together with an {\tt 'OBJECT'} defined using {\tt KOBJ}=5 (see user's guide~\cite{meot2012zgoubi}).
Let's replace our previous {\tt 'OBJECT'} definition by.
544.1192 !BRHO
5 !5: generate 11 particles used to calculate transfer matrix ('MATRIX')
0.1 0.1 0.1 0.1 .1 .001 !'smalish' step size in Y; T; Z; P; S; D
0.0 0. 0. 0. 0. 1. !reference particle's Y; T; Z; P; S; D; 'marker'. Note: Brho=BORO*D
and add the {\tt 'MATRIX'} keyword right before the {\tt 'END'} statement:
1 0
To fit the edge angle add these lines right after it:
1 !Number of physical parameters to be varied
3 36 -3.020 0.1 !element#; parameter#; inverse (minus sign) correlation; relative range
2 1e-11 100 !Number of constraints; Convergence threshold; maximum number of iterations
1 1 1 5 0.0 1. 0 !1:matrix; matrix element 1 1; element#; wanted; weigth ; 0
1 2 2 5 0.0 1. 0 !1:matrix; matrix element 2 2; element#; wanted; weigth ; 0
The fit should converge to an value for the edge angle close to 26.56\,deg.\footnote{26.56\,deg. is the number that the linear optics code {\tt TRANSOPTR} finds}.
\section{Multiparticle simulation}
I got from my good friend Jim (who simulated the HRS using {\tt COSY-INFINITY}) a file containing the coordinates of 3\,000 randomly generated particles. You can download the file from here: \href{}{link}. Each line of this file contains is (using {\tt zgoubi}'s notation): {\tt Y,T,Z,P,S,DP}. This format is what {\tt 'OBJECT'} can read when {\tt KOBJ}=3.01:
544.1192 !60 keV U1+
3.01 !read from particles from
1 3000 1 !IP1; IP2; IPStep (Read particles numbered IT1 to IT2, step ITStep)
1 1 1 !not used here
1. 1. 2. 0.25 1. 1. 1. * !scaling factors on Y,T,Z,P,S,DP
0 0 0 0 0 0 0 ! not used here
0 ! not sure what this one does
noEspread.beam ! name of the input file
Jim warned me that in this file the vertical emittance is 6\,$\mu$m (while the horizontal one is 3\,$\mu$m), and that the aspect ration between vertical size and vertical angle was wrong by a factor of 4: to fix the aspect ratio and bring the vertical emittance down to 3\,$\mu$m I use the scaling factors on line 5 of the {\tt 'OBJECT'} input.
{\it Assignment: write an input file to simulate the entire HRS from source slit to image slit. Track the 3\,000 particles in noEspread.beam and same their final coordinates to a file. Now change the mass of the particle by a factor 1/20\,000 (i.e. change its {\tt BRHO} by a factor 1/10\,000), track gaian and save the final coordinates into another file. Plot the horizontal phase space coordinates from both files, you should get a plot like~\cref{fig:twomassesInit}:}
\includegraphics*[width=0.8 \linewidth]{figure/twomasses}
\caption{Two isobars with a relative mass difference of 1/20\,000 through the HRS, before correcting non-linear aberration.}\label{fig:twomassesInit}
What you see in~\cref{fig:twomassesInit} is that the two masses completely overlap. This is (mostly) the effect of second order (sextupole) aberration. To achieve the designed resolution, we must correct the aberration.
\section{Dipole edge curvature}
To correct the second order aberration let's try to add curvature to the edges of our dipoles. Once again, we would like to adjust the edge curvature using a {\tt 'FIT'}, but what should the objective of that fit be?
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment