Home > atphysics > Radiation > thickmpoleraddiffm.m

thickmpoleraddiffm

PURPOSE ^

FINDTHICKMPOLERADDIFFM

SYNOPSIS ^

function [Bcum, Mcum, r] = findthickmpoleraddifm(rin, PolynomA, PolynomB,L, irho, E0, max_order,num_steps)

DESCRIPTION ^

FINDTHICKMPOLERADDIFFM

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 function [Bcum, Mcum, r] = findthickmpoleraddifm(rin, PolynomA, PolynomB,L, irho, E0, max_order,num_steps)
0002 %FINDTHICKMPOLERADDIFFM
0003 
0004 % Fourth order-symplectic integrator constants
0005 persistent DRIFT1 DRIFT2 KICK1 KICK2
0006 if isempty(DRIFT1)
0007     DRIFT1   = 0.6756035959798286638;
0008     DRIFT2   = -0.1756035959798286639;
0009     KICK1    =  1.351207191959657328;
0010     KICK2    = -1.702414383919314656;
0011 end
0012 
0013 
0014 
0015 SL = L/num_steps;
0016 L1 = SL*DRIFT1;
0017 L2 = SL*DRIFT2;
0018 K1 = SL*KICK1;
0019 K2 = SL*KICK2;
0020 
0021 Mcum = eye(6);
0022 Bcum = zeros(6);
0023 r = rin;
0024 
0025 for m=1:num_steps % Loop over slices
0026     
0027     [M, r] = driftm66(L1,r);
0028     Bcum = M*Bcum*M';
0029     Mcum = M*Mcum;
0030     
0031     [B, M, r] = findthinmpoleraddiffm(r, PolynomA, PolynomB, K1, irho, E0, max_order);
0032     Bcum = M*Bcum*M' + B;
0033     Mcum = M*Mcum;
0034     
0035     [M, r] = driftm66(L2,r);
0036     Bcum = M*Bcum*M';
0037     Mcum = M*Mcum;
0038     
0039     [B, M, r] = findthinmpoleraddiffm(r, PolynomA, PolynomB, K2, irho, E0, max_order);
0040     Bcum = M*Bcum*M' + B;
0041     Mcum = M*Mcum;
0042                 
0043     [M, r] = driftm66(L2,r);
0044     Bcum = M*Bcum*M';
0045     Mcum = M*Mcum;
0046     
0047     [B, M, r] = findthinmpoleraddiffm(r, PolynomA, PolynomB, K1, irho, E0, max_order);
0048     Bcum = M*Bcum*M' + B;
0049     Mcum = M*Mcum;
0050     
0051     [M, r] = driftm66(L1,r);
0052     Bcum = M*Bcum*M';
0053     Mcum = M*Mcum;
0054 
0055 end
0056 
0057 
0058 function [M, rout] = driftm66(L,r);
0059 % transfer matrix of a drift - map linearized at r
0060 
0061 Pnorm = 1/(1+r(5));
0062 NormL = L*Pnorm;
0063 M = eye(6);
0064 M([7 21]) = NormL;
0065 
0066 
0067 M([1 3],5) = -NormL*r([2,4])*Pnorm;
0068 M(6,[2 4]) = -M([1 3],5)';
0069 M(6,5) =  -NormL*Pnorm*sum(r([2,4]).^2);
0070 
0071 rout = r;
0072 rout([1 3]) = r([1 3]) + r([2 4])*NormL;
0073 rout(6) = r(6) + NormL*Pnorm*sum(r([2,4]).^2)/2;
0074

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