source: MML/trunk/mml/at/doc_html/at/findorbit4initial.html @ 4

Last change on this file since 4 was 4, checked in by zhangj, 10 years ago

Initial import--MML version from SOLEIL@2013

File size: 8.3 KB
Line 
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
2                "http://www.w3.org/TR/REC-html40/loose.dtd">
3<html>
4<head>
5  <title>Description of findorbit4initial</title>
6  <meta name="keywords" content="findorbit4initial">
7  <meta name="description" content="FINDORBIT4 finds the closed orbit in the transverse 4-d phase">
8  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
9  <meta name="generator" content="m2html &copy; 2003 Guillaume Flandin">
10  <meta name="robots" content="index, follow">
11  <link type="text/css" rel="stylesheet" href="../m2html.css">
12</head>
13<body>
14<a name="_top"></a>
15<div><a href="../index.html">Home</a> &gt;  <a href="index.html">at</a> &gt; findorbit4initial.m</div>
16
17<!--<table width="100%"><tr><td align="left"><a href="../index.html"><img alt="<" border="0" src="../left.png">&nbsp;Master index</a></td>
18<td align="right"><a href="index.html">Index for at&nbsp;<img alt=">" border="0" src="../right.png"></a></td></tr></table>-->
19
20<h1>findorbit4initial
21</h1>
22
23<h2><a name="_name"></a>PURPOSE <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
24<div class="box"><strong>FINDORBIT4 finds the closed orbit in the transverse 4-d phase</strong></div>
25
26<h2><a name="_synopsis"></a>SYNOPSIS <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
27<div class="box"><strong>function orbit = FindOrbit4initial(RING,dP,orbitguess,varargin); </strong></div>
28
29<h2><a name="_description"></a>DESCRIPTION <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
30<div class="fragment"><pre class="comment"> FINDORBIT4 finds the closed orbit in the transverse 4-d phase
31    space by numerically solving  for a fixed point of the one turn
32    map M calculated with RingPass
33
34         (X, PX, Y, PY, dP2, CT2 ) = M (X, PX, Y, PY, dP1, CT1)
35 
36    under the CONSTANT MOMENTUM constraint dP2 = dP1 = dP and
37    no constraint on the 6-th coordinate CT
38
39 IMPORTANT!!! FINDORBIT4initial imposes a constraint on dP and relaxes
40    the constraint on the revolution frequency. A physical storage
41    ring does exactly the opposite: the momentum deviation finds an
42    equilibrium for the particle on to be synchronous with the RF cavity
43
44                 HarmNumber*Frev = Frf
45
46    To impose this artifiacial constraint in FINDORBIT4initial
47    Pass function used for all elements SHOULD NOT
48    1. change the longitudinal momentum dP (cavities , magnets with radiation)
49    2. have any time dependence (localized impedance, fast kickers).
50 
51 FINDORBIT4initial(RING,dP,orbitguess) is 4x1 vector - fixed point at the
52    entrance of the 1-st element of the RING (x,px,y,py)
53
54 FINDORBIT4initial(RING,dP,orbitguess,REFPTS) is 4-by-Length(REFPTS)
55     array of coloumn vectors - fixed points (x,px,y,py)
56     at the entrance of each element indexed  REFPTS array.
57     REFPTS is an array of increasing indexes that  select elements
58     from the range 1 to length(RING)+1.
59     See further explanation of REFPTS in the 'help' for FINDSPOS 
60
61 See also:     FindOrbit6, FindSyncOrbit</pre></div>
62
63<!-- crossreference -->
64<h2><a name="_cross"></a>CROSS-REFERENCE INFORMATION <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
65This function calls:
66<ul style="list-style-image:url(../matlabicon.gif)">
67</ul>
68This function is called by:
69<ul style="list-style-image:url(../matlabicon.gif)">
70</ul>
71<!-- crossreference -->
72
73
74<h2><a name="_source"></a>SOURCE CODE <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
75<div class="fragment"><pre>0001 <a name="_sub0" href="#_subfunctions" class="code">function orbit = FindOrbit4initial(RING,dP,orbitguess,varargin);</a>
760002 <span class="comment">% FINDORBIT4 finds the closed orbit in the transverse 4-d phase</span>
770003 <span class="comment">%    space by numerically solving  for a fixed point of the one turn</span>
780004 <span class="comment">%    map M calculated with RingPass</span>
790005 <span class="comment">%</span>
800006 <span class="comment">%         (X, PX, Y, PY, dP2, CT2 ) = M (X, PX, Y, PY, dP1, CT1)</span>
810007 <span class="comment">%</span>
820008 <span class="comment">%    under the CONSTANT MOMENTUM constraint dP2 = dP1 = dP and</span>
830009 <span class="comment">%    no constraint on the 6-th coordinate CT</span>
840010 <span class="comment">%</span>
850011 <span class="comment">% IMPORTANT!!! FINDORBIT4initial imposes a constraint on dP and relaxes</span>
860012 <span class="comment">%    the constraint on the revolution frequency. A physical storage</span>
870013 <span class="comment">%    ring does exactly the opposite: the momentum deviation finds an</span>
880014 <span class="comment">%    equilibrium for the particle on to be synchronous with the RF cavity</span>
890015 <span class="comment">%</span>
900016 <span class="comment">%                 HarmNumber*Frev = Frf</span>
910017 <span class="comment">%</span>
920018 <span class="comment">%    To impose this artifiacial constraint in FINDORBIT4initial</span>
930019 <span class="comment">%    Pass function used for all elements SHOULD NOT</span>
940020 <span class="comment">%    1. change the longitudinal momentum dP (cavities , magnets with radiation)</span>
950021 <span class="comment">%    2. have any time dependence (localized impedance, fast kickers).</span>
960022 <span class="comment">%</span>
970023 <span class="comment">% FINDORBIT4initial(RING,dP,orbitguess) is 4x1 vector - fixed point at the</span>
980024 <span class="comment">%    entrance of the 1-st element of the RING (x,px,y,py)</span>
990025 <span class="comment">%</span>
1000026 <span class="comment">% FINDORBIT4initial(RING,dP,orbitguess,REFPTS) is 4-by-Length(REFPTS)</span>
1010027 <span class="comment">%     array of coloumn vectors - fixed points (x,px,y,py)</span>
1020028 <span class="comment">%     at the entrance of each element indexed  REFPTS array.</span>
1030029 <span class="comment">%     REFPTS is an array of increasing indexes that  select elements</span>
1040030 <span class="comment">%     from the range 1 to length(RING)+1.</span>
1050031 <span class="comment">%     See further explanation of REFPTS in the 'help' for FINDSPOS</span>
1060032 <span class="comment">%</span>
1070033 <span class="comment">% See also:     FindOrbit6, FindSyncOrbit</span>
1080034
1090035 <span class="keyword">if</span> ~iscell(RING)
1100036    error(<span class="string">'First argument must be a cell array'</span>);
1110037 <span class="keyword">end</span>
1120038
1130039 <span class="keyword">if</span> ~(isreal(dP) &amp; length(dP)==1)
1140040    error(<span class="string">'Second argument must be a scalar'</span>);
1150041 <span class="keyword">end</span> 
1160042
1170043 <span class="keyword">if</span> ~(isreal(orbitguess) &amp; length(orbitguess)==6)
1180044    error(<span class="string">'Third argument must be a 6x1 matrix'</span>);
1190045 <span class="keyword">end</span> 
1200046
1210047   
1220048 <span class="comment">%d = sqrt(eps);    % step size for numerical differentiation</span>
1230049 d = 1e-10;
1240050 max_iterations = 20;
1250051 J = zeros(4);
1260052 Ri = orbitguess;
1270053 Ri(5) = dP;
1280054
1290055 change = 1;
1300056 itercount = 0;
1310057 <span class="keyword">while</span> (change&gt;eps) &amp; (itercount &lt; max_iterations)
1320058    RMATi=[Ri Ri Ri Ri Ri];               
1330059    <span class="keyword">for</span> k = 1:4
1340060       RMATi(k,k)=RMATi(k,k)+d;
1350061    <span class="keyword">end</span>
1360062    RMATf = ringpass(RING,RMATi);
1370063    Rf = RMATf(:,5);
1380064    <span class="comment">% compute the transverse part of the Jacobian</span>
1390065   
1400066    J = (RMATf(1:4,1:4) - [Rf(1:4) Rf(1:4) Rf(1:4) Rf(1:4)])/d;
1410067    B = inv(J-diag(ones(1,4)));
1420068    B(5,5)=1;
1430069    B(6,6)=0;
1440070    Ri_next = Ri - B*(Rf-Ri);
1450071    change = norm(Ri_next - Ri);
1460072    Ri = Ri_next;
1470073    itercount = itercount+1;
1480074 <span class="keyword">end</span>;
1490075
1500076 <span class="keyword">if</span>(nargin&lt;4)   <span class="comment">% return only the fixed point at the entrance of RING{1}</span>
1510077    orbit=Ri(1:4,1);
1520078 <span class="keyword">else</span>            <span class="comment">% 3-rd input argument - vector of reference points alog the Ring</span>
1530079                 <span class="comment">% is supplied - return orbit</span>
1540080    orb6 = linepass(RING,Ri,varargin{1});
1550081    orbit = orb6(1:4,:);
1560082 <span class="keyword">end</span></pre></div>
157<hr><address>Generated on Fri 18-May-2007 17:13:39 by <strong><a href="http://www.artefact.tk/software/matlab/m2html/">m2html</a></strong> &copy; 2003</address>
158</body>
159</html>
Note: See TracBrowser for help on using the repository browser.