Home > pubtools > calc_Touschek.m

calc_Touschek

PURPOSE ^

tauT = calc_Touschek(THERING, Ib)

SYNOPSIS ^

function tauT = calc_Touschek(THERING,Ib,varargin)

DESCRIPTION ^

tauT = calc_Touschek(THERING, Ib)
tauT = calc_Touschek(THERING, Ib,hori_acceptance)
tauT = calc_Touschek(THERING, Ib,hori_acceptance,U0)
tauT = calc_Touschek(THERING, Ib,hori_acceptance,U0,coupling)
tauT = calc_Touschek(THERING, Ib,hori_acceptance,U0,coupling,sigE,emit_x)
   hori_acceptance = Min(X/sqrt(beta)) around the ring
        Ib, mA, single bunch current
        Nb, number of bunches
        U0, MeV, one-turn energy loss
       emit_x, nm-rad
ex: 
tauT = calc_Touschek(THERING, 100/280, 0.015/sqrt(10.37),1.04,0.064e-2,0.001, 18)/3600

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 function tauT = calc_Touschek(THERING,Ib,varargin)
0002 %tauT = calc_Touschek(THERING, Ib)
0003 %tauT = calc_Touschek(THERING, Ib,hori_acceptance)
0004 %tauT = calc_Touschek(THERING, Ib,hori_acceptance,U0)
0005 %tauT = calc_Touschek(THERING, Ib,hori_acceptance,U0,coupling)
0006 %tauT = calc_Touschek(THERING, Ib,hori_acceptance,U0,coupling,sigE,emit_x)
0007 %   hori_acceptance = Min(X/sqrt(beta)) around the ring
0008 %        Ib, mA, single bunch current
0009 %        Nb, number of bunches
0010 %        U0, MeV, one-turn energy loss
0011 %       emit_x, nm-rad
0012 %ex:
0013 %tauT = calc_Touschek(THERING, 100/280, 0.015/sqrt(10.37),1.04,0.064e-2,0.001, 18)/3600
0014 %
0015 alpha=1.7e-4;
0016 
0017 hori_acceptance = Inf;
0018 if nargin>=3
0019     hori_acceptance = varargin{1};
0020 end
0021 
0022 if nargin<7
0023 %   atsum = atsummary
0024     atsum = tlssummary
0025 end
0026 
0027 
0028 if nargin>=4
0029     U0 = varargin{2}*1e6; %eV
0030 else
0031     U0 = atsum.radiation*1e9; %eV
0032 %U0 = 1.04e6; %eV
0033 end
0034 coupling = 0.05*1e-2; %by default
0035 if nargin>=5
0036     coupling = varargin{3};
0037 end
0038 
0039 if nargin>=7
0040    sigE = varargin{4};
0041    emit_x = varargin{5}*1e-9; %m-rad
0042 else
0043     sigE = atsum.naturalEnergySpread  %sigma_delta
0044     emit_x = atsum.naturalEmittance
0045 
0046 end
0047 
0048 e0 = 1.6e-19; %Coulomb
0049 cspeed = 299792458; 
0050 r0 = 2.82e-15; %m
0051 
0052 
0053 %cavity related parameters
0054 cava = findcells(THERING,'PassMethod','ThinCavityPass');
0055 cavb = findcells(THERING,'PassMethod','CavityPass');
0056 CAVINDEX = sort([cava,cavb]); %ati1.RF;
0057 if isempty(CAVINDEX)
0058     error('cavity not defined')
0059 end
0060 freq = THERING{CAVINDEX(1)}.Frequency;
0061 harm = THERING{CAVINDEX(1)}.HarmNumber;
0062 E0 = THERING{CAVINDEX(1)}.Energy;
0063 gamma = THERING{CAVINDEX(1)}.Energy/0.511e6;
0064 
0065 Vrf = 0;
0066 for ii=1:length(CAVINDEX)
0067     Vrf = Vrf + THERING{CAVINDEX(ii)}.Voltage;
0068 end
0069 %Vrf = 3.2e6;
0070 Vrf = 1.6e6;
0071 %[alpha,a2] = findmcf3(THERING);
0072 
0073 %bunch length
0074 phi_s = asin(U0/Vrf);
0075 nus = sqrt(harm*Vrf*alpha*cos(phi_s)/2/pi/E0);
0076 
0077 sigZ = sigE/nus*harm*alpha/2/pi/freq*cspeed;
0078 
0079 %rf bucket height
0080 delta_max_rf = sqrt(2*U0/pi/alpha/harm/E0)*sqrt( sqrt((Vrf/U0).^2-1) - acos(U0./Vrf));
0081 %---------------------------------
0082 
0083 %beam size around the ring
0084 [td, tune,chrom] = twissring(THERING,0,1:length(THERING)+1, 'chrom', 1e-5);
0085 Dx = cat(2, td.Dispersion)';
0086 betxy = cat(1, td.beta);
0087 alfxy = cat(1, td.alpha);
0088 
0089 spos = cat(1,td.SPos);
0090 circ = spos(end);
0091 
0092 sigX = sqrt(betxy(:,1)*emit_x+Dx(:,1).^2*sigE^2);
0093 
0094 sigY = sqrt(betxy(:,2)*emit_x*coupling);
0095 sigXp = sqrt(emit_x*(1+alfxy(:,1).^2)./betxy(:,1)+Dx(:,2).^2*sigE^2);
0096 %--------------------------------
0097 curH = (Dx(:,1).^2 + (betxy(:,1).*Dx(:,2)+alfxy(:,1).*Dx(:,1)).^2)./betxy(:,1);
0098 
0099 display('delta_max_perp data:  ');
0100 delta_max_perp = hori_acceptance./sqrt(curH);
0101 display('delta_max data:  ');
0102 delta_max = min([delta_max_perp, ones(size(curH))*delta_max_rf]')';
0103 display('xi data:  ');
0104 xi = (delta_max/gamma.*betxy(:,1)./sigX).^2;
0105 Dval = funcD(xi);
0106 
0107 N0 = 0.001/(freq/harm)/e0; %Number of particle per 1mA bunch.
0108 
0109 ds = diff(spos);
0110 n=1:length(THERING);
0111 
0112 avgfac = sum(Dval(n)./sigX(n)./sigY(n)/sigZ./delta_max(n).^3.*ds)/circ;
0113 lossrate = Ib*N0*r0^2*cspeed/8/gamma^2/pi*avgfac;
0114 
0115 tauT = 1/lossrate;
0116 
0117 if 0
0118    figure
0119    plot(spos, delta_max, spos, delta_max_rf*ones(size(spos))); 
0120    %set(gca,'fontsize', 16,'xlim',[0,240])
0121    set(gca,'fontsize', 16,'xlim',[0,120])
0122    xlabel('s (m)')
0123    ylabel('\delta_{max}')
0124    grid
0125    %set(gca,'ylim',[0,0.04]);
0126    set(gca,'ylim',[0,0.15]);
0127    
0128 end
0129 
0130 function D=funcD(xi)
0131 %a look-up table
0132 DfunTable = [
0133 %xi                Dfunc
0134 0.000500    0.123802    
0135 0.001000    0.153464    
0136 0.001500    0.172578    
0137 0.002000    0.186757    
0138 0.002500    0.198008    
0139 0.003000    0.207298    
0140 0.003500    0.215179    
0141 0.004000    0.221992    
0142 0.004500    0.227968    
0143 0.005000    0.233269    
0144 0.005500    0.238015    
0145 0.006000    0.242294    
0146 0.006500    0.246176    
0147 0.007000    0.249717    
0148 0.007500    0.252961    
0149 0.008000    0.255944    
0150 0.008500    0.258697    
0151 0.009000    0.261244    
0152 0.009500    0.263607    
0153 0.010000    0.265805    
0154 0.010500    0.267852    
0155 0.011000    0.269763    
0156 0.011500    0.271549    
0157 0.012000    0.273221    
0158 0.012500    0.274788    
0159 0.013000    0.276259    
0160 0.013500    0.277640    
0161 0.014000    0.278938    
0162 0.014500    0.280159    
0163 0.015000    0.281308    
0164 0.015500    0.282391    
0165 0.016000    0.283411    
0166 0.016500    0.284372    
0167 0.017000    0.285278    
0168 0.017500    0.286132    
0169 0.018000    0.286938    
0170 0.018500    0.287698    
0171 0.019000    0.288415    
0172 0.019500    0.289090    
0173 0.020000    0.289727    
0174 0.020500    0.290327    
0175 0.021000    0.290893    
0176 0.021500    0.291425    
0177 0.022000    0.291926    
0178 0.022500    0.292397    
0179 0.023000    0.292840    
0180 0.023500    0.293256    
0181 0.024000    0.293646    
0182 0.024500    0.294011    
0183 0.025000    0.294352    ];
0184 ximin = DfunTable(1,1);
0185 ximax = DfunTable(end,1);
0186 xi(find(xi<ximin)) = ximin;
0187 xi(find(xi>ximax)) = ximax;
0188 D = interp1(DfunTable(:,1), DfunTable(:,2), xi,'linear');
0189

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