Home > atphysics > TouschekPiwinski > momentum_aperture_at.m

momentum_aperture_at

PURPOSE ^

function [deltamin, deltamax...

SYNOPSIS ^

function [deltamax]=momentum_aperture_at(THERING,deltalimit,initcoord,delta,precdelta,deltastepsize,splits,split_step_divisor,nturns)

DESCRIPTION ^

 function [deltamin, deltamax...
     ]=momentum_aperture_at(THERING,...
     deltalimit,... [min max]
     initcoord,... [x y] initial coordinate
     delta,...
     precdelta,...
     deltastepsize,...
     splits,... % number of splitting
     split_step_divisor)  % divide the step size at every split

 following the ELEGANT routine:
 Start with ? = 0, i.e., zero momentum offset.
 2. Track a particle to see if it gets lost. If so, proceed to step 4.
 3. Increase ? by step size ?? and return to step 2.
 4. If no splitting steps remain, proceed to the next step. Otherwise:
 (a) Change ? to deltas ? sb??., where ?s is the largest ? for which the particle survived, and sb is the steps_back parameter.
 (b) Divide the step size by split_step_divisor to get a new step size ??.
 (c) Set?=?+??.
 (d) Decrement the ?splits remaining? counter by 1.
 (e) Continue from step 2.
 5. Stop. The momentum aperture is ?s

 ex: [deltamax]=momentum_aperture_at(THERING,0.1,[10^-6 10^-6],0,0,0.01,3,10,100)
 ex: [deltamin]=momentum_aperture_at(THERING,-0.1,[10^-6 10^-6],0,0,-0.01,3,10,100)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [deltamax]=momentum_aperture_at(THERING,deltalimit,initcoord,delta,precdelta,deltastepsize,splits,split_step_divisor,nturns)
0002 % function [deltamin, deltamax...
0003 %     ]=momentum_aperture_at(THERING,...
0004 %     deltalimit,... [min max]
0005 %     initcoord,... [x y] initial coordinate
0006 %     delta,...
0007 %     precdelta,...
0008 %     deltastepsize,...
0009 %     splits,... % number of splitting
0010 %     split_step_divisor)  % divide the step size at every split
0011 %
0012 % following the ELEGANT routine:
0013 % Start with ? = 0, i.e., zero momentum offset.
0014 % 2. Track a particle to see if it gets lost. If so, proceed to step 4.
0015 % 3. Increase ? by step size ?? and return to step 2.
0016 % 4. If no splitting steps remain, proceed to the next step. Otherwise:
0017 % (a) Change ? to deltas ? sb??., where ?s is the largest ? for which the particle survived, and sb is the steps_back parameter.
0018 % (b) Divide the step size by split_step_divisor to get a new step size ??.
0019 % (c) Set?=?+??.
0020 % (d) Decrement the ?splits remaining? counter by 1.
0021 % (e) Continue from step 2.
0022 % 5. Stop. The momentum aperture is ?s
0023 %
0024 % ex: [deltamax]=momentum_aperture_at(THERING,0.1,[10^-6 10^-6],0,0,0.01,3,10,100)
0025 % ex: [deltamin]=momentum_aperture_at(THERING,-0.1,[10^-6 10^-6],0,0,-0.01,3,10,100)
0026 
0027 %disp([delta splits])
0028 
0029 if ( delta>=0 && delta<deltalimit) ||  ( delta<=0 && delta>deltalimit)
0030         
0031     if splits>-1
0032                 
0033         % track for this delta
0034         
0035         [~, LOSS] =ringpass(THERING,[initcoord(1) 0 initcoord(2) 0 delta 0]',nturns);
0036         
0037         if LOSS~=1 % if NOT LOST go to next step
0038             
0039             [deltamax...
0040                 ]=momentum_aperture_at(THERING,...
0041                 deltalimit,... [min max]
0042                 initcoord,... [x y]
0043                 delta+deltastepsize,... % delta center
0044                 delta,...
0045                 deltastepsize,...
0046                 splits,... % number of splitting
0047                 split_step_divisor,...
0048                 nturns);
0049             
0050         else % if LOST reduce stepsize
0051             
0052             [deltamax...
0053                 ]=momentum_aperture_at(THERING,...
0054                 deltalimit,... [min max]
0055                 initcoord,... [x y]
0056                 precdelta+deltastepsize/split_step_divisor,... % go back to previous delta center and increase of smaller step
0057                 precdelta,...
0058                 deltastepsize/split_step_divisor,...
0059                 splits-1,... % number of splitting
0060                 split_step_divisor,...
0061                 nturns);
0062             
0063         end
0064     else
0065         
0066         % no splitting steps remain
0067         deltamax=delta-deltastepsize;
0068         
0069     end
0070     
0071 else
0072     % limit reached
0073     deltamax=delta;
0074 end
0075 
0076 
0077 return;
0078 
0079 
0080

Generated on Thu 24-Aug-2017 18:47:33 by m2html © 2005