UBC Theses and Dissertations

UBC Theses Logo

UBC Theses and Dissertations

Properties of ion orbits in the central region of a cyclotron Louis, Robert John 1971

Your browser doesn't seem to have a PDF viewer, please download the PDF to view this item.

Item Metadata

Download

Media
831-UBC_1971_A1 L68.pdf [ 8.99MB ]
Metadata
JSON: 831-1.0084831.json
JSON-LD: 831-1.0084831-ld.json
RDF/XML (Pretty): 831-1.0084831-rdf.xml
RDF/JSON: 831-1.0084831-rdf.json
Turtle: 831-1.0084831-turtle.txt
N-Triples: 831-1.0084831-rdf-ntriples.txt
Original Record: 831-1.0084831-source.json
Full Text
831-1.0084831-fulltext.txt
Citation
831-1.0084831.ris

Full Text

THE PROPERTIES OF ION ORBITS IN THE CENTRAL REGION OF A CYCLOTRON by ROBERT JOHN LOUIS B . S c , Un ivers i ty of V i c t o r i a , 1966 M . S c , Un ivers i ty of V i c t o r i a , 1968 A thes is submitted in p a r t i a l f u l f i l m e n t of the requirements for the degree of Doctor of Philosophy in the Department of Phys i cs We accept th is thes is as conforming to the required standard THE UNIVERSITY OF BRITISH COLUMBIA January, 1971 In presenting this thesis in partial fulfilment of the requirements for an advanced degree at the University of Br i t ish Columbia, I agree that the Library shall make it freely available for reference and study. I further agree that permission for extensive copying of this thesis for scholarly purposes may be granted by the Head of my Department or by his representatives. It is understood that copying or publication of this thesis for financial gain shall not be allowed without my written permission. Department of Physics The University of Br i t ish Columbia Vancouver 8, Canada Date February 11, 1971 ABSTRACT The behaviour of ion o r b i t s in the magnetic and e l e c t r i c f i e l d s at the centre of a cyc lo t ron is studied in d e t a i l . The ob jec t ive is to opt imize the phase acceptance and beam q u a l i t y for a 500 MeV H" isochronous c y c l o t r o n . Since accurate e l e c t r i c f i e l d s are necessary for o r b i t c a l c u l a t i o n s , a numerical method for c a l c u l a t i n g these f i e l d s is examined in d e t a i l . The method is s u i t a b l e for complicated e lec t rode shapes and converges r a p i d l y , y i e l d i n g p o t e n t i a l s in three dimensions with average er rors of less than 0.01%. The magnetic f i e l d s used in the o r b i t c a l c u l a t i o n s are measured on model magnets. The ax ia l motions are examined using a th ick lens approximation for the a c c e l e r a t i n g gaps. A method is demonstrated for c a l c u l a t i n g the ax ia l acceptance of the cyc lo t ron as a funct ion of RF phase. This method is used to evaluate the merits of var ious centra l geometries and i n j e c t i o n energ ies . This method is a lso used to examine the e f f e c t s of f l a t - t o p p i n g the RF vol tage by adding some t h i r d harmonic to the fundamental waveform. It is found that add i t ion of the optimum amount of t h i r d harmonic increases the phase acceptance by about 20 deg. F i n a l l y , the e f f e c t s of f i e l d bumps on the axia l motions are inves t iga ted . To allow accurate radia l motion c a l c u l a t i o n s to high energy, an approx i -mate formula is developed which y i e l d s accurate (<1%) values for the changes in o r b i t proper t ies of an ion c ross ing a dee gap. The geometry of the o r b i t on the f i r s t turn is d iscussed in d e t a i l . The radia l cent r ing is studied by t rack ing ions from i n j e c t i o n to 20 MeV, and a method is descr ibed for choosing the s t a r t i n g condi t ions of the beam so as to minimize the rad ia l betatron amplitude over a desi red phase range. i i The problems associated with using a t h r e e - f o l d symmetric magnetic f i e l d with a two-fo ld symmetric e l e c t r i c f i e l d are a lso d i s c u s s e d . Besides the well-known gap-cross ing resonance, a prev ious ly ignored phase-o s c i l l a t i o n e f f e c t is found to be important for cyc lo t rons operat ing on a high harmonic of the ion rotat ion frequency. TABLE OF CONTENTS Page Chap t e r 1. INTRODUCTION 1 A. Problems i n the C y c l o t r o n C e n t r a l Region 1 B. The TRIUMF C y c l o t r o n 3 C. E q u a t i o n s o f M o t i o n 5 C h a p t e r 2 . ELECTRIC FIELD CALCULATIONS 8 A. C h o i c e o f Method 8 B. F i n i t e D i f f e r e n c e A p p r o x i m a t i o n 9 C. C o m p u t a t i o n a l D e t a i l s 1 3 D. Convergence T e s t s 1 7 E. The P r a c t i c a l Problem 2 1 C h a p t e r 3 - AXIAL MOTIONS 2 5 A. I n t r o d u c t i o n 2 5 B. M a g n e t i c F i e l d 2 6 C. Space Charge F o r c e s 2 8 D. E l e c t r i c Lens E f f e c t s 3 0 E. C a l c u l a t i o n o f C y c l o t r o n A c c e p t a n c e 3h F. Phase Space A c c e p t a n c e f o r V a r i o u s TRIUMF C e n t r a l Geometries and I n j e c t i o n E n e r g i e s 3 8 G. E f f e c t s o f T h i r d Harmonic i n the RF on A x i a l M o t i o n s h\ H. E f f e c t s o f F i e l d Bumps A 3 C h a p t e r h. RADIAL MOTIONS hi A. I n t r o d u c t i o n hi B. B a s i c Design h8 C. Problems w i t h T h r e e - S e c t o r M a g n e t i c F i e l d s 5 5 D. R a d i a l C e n t r i n g 6 0 E. E f f e c t s o f F i n i t e Beam E m i t t a n c e 6 8 C h a p t e r 5 . RADIAL LENS EFFECTS OF CYCLOTRON DEE GAPS 71 A. I n t r o d u c t i o n 71 B. C o n s t a n t G r a d i e n t A p p r o x i m a t i o n w i t h No M a g n e t i c F i e l d 7 2 C. S i n e G r a d i e n t A p p r o x i m a t i o n 7 8 D. Co n s t a n t G r a d i e n t A p p r o x i m a t i o n w i t h T h i r d Harmonic i n the E l e c t r i c F i e l d 8 0 E. C o n s t a n t G r a d i e n t A p p r o x i m a t i o n w i t h M a g n e t i c F i e l d 81 F. C o n s t a n t i G r a d i e n t A p p r o x i m a t i o n w i t h M a g n e t i c F i e l d and T h i r d Harmonic i n the E l e c t r i c F i e l d 8 5 C h a p t e r 6 . SUMMARY AND CONCLUSIONS 8 8 i v CONTENTS (cont'd) Page References 91 Figures Sh Appendix A. Theory of Successive Over-Relaxat ion 153 Appendix B. Boundary Condit ions for Relaxation Ca lcu la t ions 160 Appendix C. New Relaxation I terat ion Routines 176 Appendix D. Program AXCENT 192 v LIST OF TABLES L a r g e s t e i g e n v a l u e (X m ) and b e s t o v e r - r e l a x a t i o n f a c t o r (a^) f o r v a r i o u s s i z e r e l a x a t i o n problems Sequence o f o p e r a t i o n s used t o s o l v e a 64x64x32 node r e l a x a t i o n problem Average e r r o r a f t e r v a r i o u s numbers o f i t e r a t i o n s o v e r the reduced problem Sequence o f o p e r a t i o n s used t o s o l v e a 512x128x32 node r e l a x a t i o n p roblem Gap f a c t o r s g i v e n by n u m e r i c a l i n t e g r a t i o n and by the c o n s t a n t g r a d i e n t a p p r o x i m a t i o n (no magnetic f i e l d ) Gap f a c t o r s g i v e n by n u m e r i c a l i n t e g r a t i o n and by the c o n s t a n t g r a d i e n t a p p r o x i m a t i o n ( i s o c h r o n o u s m a g n e t i c f i e l d v I LIST OF FIGURES Page 1.1 Central region of the TRIUMF cyc lo t ron - median plane Sh 1.2 Central region of the TRIUMF cyc lo t ron - sect ion through c e n t r e l i n e of h i l l #3 95 2.1 Relaxation mesh o r g a n i z a t i o n ; tota l number of nodes is (p+1)(q+1)(r+1) 96 2.2 Average e r ror and average change per i t e r a t i o n vs number of sweeps over large volume 97 2.3 Average e r ro r vs number of sweeps over large volume for various values of a 98 2.4 Number of nodes with a given e r ro r vs s i ze of e r ro r for var ious number of sweeps over large volume 99 2.5 Number of nodes with a given e r ror vs number of sweeps over large volume for var ious s i z e e r rors 100 3.1 Magnetic ax ia l focusing frequency (v z) vs energy for three-and s i x - s e c t o r magnetic geometries 101 3.2 Equivalent ax ia l focusing frequency produced by space charge forces vs energy for var ious beam currents and axia l beam heights 102 3-3 C r o s s - s e c t i o n of dees near a c c e l e r a t i n g region showing e l e c t r i c equ ipo ten t ia ls and (schematical ly) an ion t ra jec to ry 103 3.4 Comparison between equivalent e l e c t r i c ax ia l focusing frequencies predic ted by the thin lens approximation and determined by numerical in tegra t ion 104 3.5 Poss ib le TRIUMF centra l geometry with three a c c e l e r a t i n g gaps in the f i r s t h a l f - t u r n 105 3.6 Axia l emittance e l l i p s e s required at in jec t ion fo r var ious RF phases 106 3.7 Axia l acceptance vs RF phase for var ious in jec t ion energies (one a c c e l e r a t i n g gap in the f i r s t h a l f - t u r n ) 107 3.8 Axia l acceptance vs RF phase for var ious in jec t ion energ ies (three a c c e l e r a t i n g gaps in the f i r s t h a l f - t u r n ) 108 3.9 Average ax ia l acceptance (averaged from -30 deg to +60 deg) vs i n j e c t i o n energy (one a c c e l e r a t i n g gap in the f i r s t h a l f -turn) 109 3.10 Axia l acceptance vs RF phase for var ious choices of the i n i t i a l emittance e l l i p s e 110 v i i 3.11 RF v o l t a g e waveforms w i t h v a r i o u s amounts o f t h i r d harmonic and phase s h i f t between fundamental and t h i r d harmonic 3.12 S l o p e o f RF v o l t a g e waveform w i t h v a r i o u s amounts o f t h i r d h armonic and phase s h i f t between fundamental and t h i r d harmonic 3.13 A x i a l a c c e p t a n c e vs RF phase f o r v a r i o u s c h o i c e s o f the i n i t i a l e m i t t a n c e e l l i p s e , e = 0 . 1 7 , 5 = 0 3.14 A x i a l a c c e p t a n c e vs RF phase f o r v a r i o u s choi5es>of the i n i t i a l e m i t t a n c e e l l i p s e * ;e = 0.12, 6 = 0 3 . 1 5 A x i a l a c c e p t a n c e vs RF phase f o r v a r i o u s c h o i c e s o f the i n i t i a l e m i t t a n c e e l l i p s e , e = 0 . 1 5 , <$ = -10 deg 3.16 T o t a l (magnetic and e l e c t r i c ) e q u i v a l e n t a x i a l f o c u s i n g f r e q u e n c y vs energy f o r v a r i o u s RF phases 3.17 T r a n s i t i o n phase ( o f t o t a l a x i a l f o c u s i n g from n e g a t i v e t o p o s i t i v e ) vs energy 3 . 1 8 Change i n s i n e o f RF phase r e q u i r e d . t o keep i o n a t t r a n s i -t i o n phase vs r a d i u s 3 . 1 9 M a g n e t i c f i e l d bump r e q u i r e d t o keep i o n a t t r a n s i t i o n phase vs r a d i u s 4 \ 1 Geometry o f i n j e c t i o n gap and f i r s t main gap f o r two RF phases 4.2 y c vs RF phase a t i n j e c t i o n gap f o r v a r i o u s i n j e c t i o n gap p o s i t i o n s 4.3 Energy g a i n i n i n j e c t i o n gap.and f i r s t main gap vs RF phase a t i n j e c t i o n gap f o r v a r i o u s i n j e c t i o n gap p o s i t i o n s 4.4 RF phase a t f i r s t main gap vs RF phase a t i n j e c t i o n gap f o r v a r i o u s i n j e c t i o n gap p o s i t i o n s 4 . 5 Phase o s c i l l a t i o n a m p l i t u d e vs c e n t r i n g e r r o r a t v a r i o u s rad i i 4.6 RF phase v s ' h a l f - t u r n number f o r v a r i o u s i n i t i a l phases w i t h no f l u t t e r i n t h e m a g n e t i c f i e l d 4.7 Geometry o f an o r b i t i n a t h r e e - s e c t o r magnetic f i e l d 4 . 8 RF phase d i f f e r e n c e on s u c c e e d i n g h a l f - t u r n s as a f u n c t i o n o f o r i e n t a t i o n o f the dee gap (6) 4 . 9 RF phase vs h a l f - t u r n number f o r v a r i o u s i n i t i a l phases w i t h a t h r e e - s e c t o r m a g n e t i c f i e l d (6 = 30 deg) v i i i Page 4.10 Ratio of third harmonic amplitude in magnetic f ie ld to average f ie ld vs radius for (three-sector) f ie ld l - l 4 - 5 - 7 0 12(8 4.11 Average orbit radius and maximum orbit scalloping vs radius for ' (s ix-sector) f ie ld 1-30-06-70 1 2§ 4.12 Geometry of an orbit in a six-sector magnetic f ie ld 13Q 4.13 Geometry of the difference between an equilibrium orbit and an accelerated orbit 131' 4.14 Centre-point displacement along the dee gap vs energy show-ing values from numerical orbit tracks and from an analytic approximation 132 4.15 Accelerated phase plot inwards from 5 MeV, <j) = - 3 0 deg 133 4.16 Accelerated phase plot inwards from 5 MeV, <j> = 0 deg 134 4.17 Accelerated phase plot inwards from 5 MeV, <)> = +30 deg 1135/ 4.18 Accelerated phase plot outwards for various radii at f i r s t main dee gap, <}> = 0 deg 1 36 4.19 Accelerated phase plot outwards from inflector exit for .. various phases; ion with <j> = 0 i s centred '137' 4.20 Accelerated phase plot outwards from inflector exit for various phases; ion with <j> = +17 deg is centred 13$ 4.21 Betatron osc i l la t ion amplitude vs RF phase for various starting conditions •139' 4.22 Phase histories of ions with various starting phases in a magnetic f ie ld with a f ie ld bump 140' 4.23 Accelerated phase plot outwards from inflector exit for various phases using the magnetic f ie ld with the f ie ld bump; ion with <j> = 17 deg is centred l A l ; 4.24 Accelerated phase plots with <j> = 0 deg for four,points on the edge of the emittance el 1i pse a) matched to v f = 1, and b) chosen to reduce the radial osc i l la t ion amplitude over the phase range -5 deg to +25 deg 1.42-4.25 Accelerated phase plots with cj> = +15 deg for four points on the edge of the emittance e l l ipse a) matched to v r = 1, and b) chosen to reduce the radial osc i l la t ion amplitude over the phase range -5")deg:>td +25 deg 143 4.26 Accelerated phase P|lats with <J> = +25 deg for four'points on the edge of the emittance e l l ipse a) matched to v p = 1, and b) chosen to reduce the radial osc i l la t ion amplitude over the phase range -5 deg to +25 deg -14.4' ix Page 5.1 C r o s s - s e c t i o n of a dee gap showing e l e c t r i c equ ipo ten t ia ls 145' 5.2 E l e c t r i c potent ia l vs d is tance from dee gap centre showing actual values and constant gradient approximation 1 46;< 5-3 Geometry of an ion c ross ing a dee gap 14 5.4 Gap fac tors vs energy for <j) =. 0 deg 1 '18. 5-5 D i f ferences between gap fac tors obtained from numerical in tegra t ion and those obtained from the constant gradient approximation as a funct ion of energy, no magnetic f i e l d \h3) 5.6 D i f ferences between gap fac tors obtained from numerical in tegra t ion and those obtained from the constant gradient approximation as a funct ion of energy, with an isochronous ^ magnetic f i e l d 150/ 5.7 D i f ferences between gap fac to rs obtar-ned from numerical in tegra t ion and those obtained from the constant gradient approximation as a funct ion of RF phase, with an isochronous _ magnetic f i e l d 151-5.8 Apparent displacement due to change in radius of curvature of the ion path whi le c ross ing the dee gap 1.5.2? ACKNOWLEDGEMENTS I would l i k e to thank Dr. M.K. Craddock fo r superv is ing th is work and for prov id ing guidance and he lpfu l suggestions throughout the course of my studies at U .B .C . I would a lso l i k e to thank Dr. G.H. Mackenzie for several he lpfu l d i s c u s -sions and Miss Ann K o r i t z , Mr. Neil Fraser and the s t a f f of the Computing Centre at U . B . C . for the i r help in wr i t ing and debugging the computer programs. F i n a l l y I would l i k e to thank Miss Ada Strathdee for her pat ience and perseverance whi le typing th is t h e s i s . F inanc ia l support from the TRIUMF project throughout the course of th is work is g r a t e f u l l y acknowledged. xi CHAPTER 1. INTRODUCTION A. Problems in the Cyclotron Central Region The centra l region of a cyc lo t ron requires spec ia l a t tent ion because the internal beam q u a l i t y and phase acceptance are p r imar i l y determined during i n j e c t i o n and the f i r s t few turns within the machine. During these i n i t i a l tu rns , the beam has low energy and is therefore s t rongly inf luenced by the phase-dependent . l fhsef fec ts of the dee gaps. The ob jec t ive of th is work is to study the behaviour of ion o r b i t s in the magnetic and e l e c t r i c f i e l d s at the cyc lo t ron cen t re , and thereby to choose the beam in jec t ion condi t ions and magnet and e lec t rode designs for optimum beam performance, i . e . a beam which is cent red , has minimum spot s i z e in both the rad ia l and ax ia l d i r e c t i o n s , and is in a phase interval which optimizes the a c c e l e r a -t ion process . The usual s tudies of cyc lo t ron centra l reg ions , for example R o s e , 1 and o t h e r s , 2 - 4 are concerned with machines with internal ion sources where the ion s t a r t s with zero energy and spends i ts f i r s t turn 'ma i n 1 y wi th i n. the ?. e l e c t r i c f i e l d produced'by the dee gap. With an external ion source , the problems are qui te d i f f e r e n t ; to solve them th is study was undertaken. In ject ion of ions into a cyc lo t ron from an external source has been studied by Powell and Reece; 5 however, the in jec t ion energy in the i r case was 11 keV, compared to a maximum energy gain of 50 keV per t u r n , whereas in th is case the i n j e c t i o n energy is 300 keV, compared to 400 keV per tu rn . A l s o , the e lect rode geometry is very d i f f e r e n t . This thes is considers ion i n j e c t i o n for a H~ cyc lo t ron where the ions are ext racted.by e lec t ron s t r i p p i n g and the duty c y c l e is determined by the phase band the centra l region w i l l transmit and not by the ex t rac t ion system, as in some cyc lo t rons with resonant ex t rac t ion schemes. Thus there 2 is considerable emphasis on reducing phase-dependent e f f e c t s in the centra l reg ion . The centra l region problems f a l l na tu ra l l y into two groups, those con-cerning the ax ia l motions and those concerning the radia l motions. The bas ic problem in the ax ia l motion" is that the focusing provided by the magnetic f i e l d becomes very small near the centre of the machine, while the (phase-dependent) e l e c t r i c forces due to the dee gaps become very s t rong . It is well known1 that the e l e c t r i c forces are defocusing for ha l f of the RF c y c l e . Since these e l e c t r i c forces w i l l be larger than the (focusing) magnetic forces at low energy, a de ta i l ed study of the ax ia l motions is required i f a large range of RF phases is to be accepted. The s i t u a t i o n is fur ther complicated by the fac t that space charge e f f e c t s w i l l a lso tend to expand the beam. Space charge e f f e c t s w i l l be most important at low energy and high cur ren t . The bas ic problem in the radia l motion is not lack of focusing but rather how to minimize.the radia l o s c i l l a t i o n amplitudes of the ions. Since the ions are extracted when they reach a p a r t i c u l a r rad ius , a large spread in rad ia l amplitudes means that ions from d i f f e r e n t turns may be present at the ex t rac t ion r a d i u s , r e s u l t i n g in a large energy spread in the extracted beam. The i n i t i a l motion of the ions in the cyc lo t ron requires that the beam be in jected o f f centre i f i t is to be centred at e x t r a c t i o n ; however, th is e f f e c t is phase dependent, making i t d i f f i c u l t to centre ions with a wide range of phases. Since a knowledge of the e l e c t r i c f i e l d s involved is required for s tudies of both the ax ia l and rad ia l motions, Chapter 2 descr ibes in de ta i l a method for c a l c u l a t i n g these f i e l d s . Chapter 3 considers the ax ia l motions. A method is presented which 3 allows c a l c u l a t i o n of the ax ia l acceptance of the acce le ra to r as a funct ion of RF phase. This method is used to study var ious i n j e c t i o n energies and the e f f e c t s of adding t h i r d harmonic to the RF. F i n a l l y , the e f f e c t s of f i e l d bumps, used to induce phase s l i p , are cons idered . Chapter k considers the radia l motions. The geometry of the f i r s t turn and how th is is inf luenced by the a c c e l e r a t i n g e lect rodes is studied in d e t a i l . The radia l cent r ing is studied by t racking ions from i n j e c t i o n out to 20 MeV. F i n a l l y , the e f f e c t s of a f i n i t e beam s i ze are cons idered . Chapter 5 descr ibes an approximation which allows the changes in o r b i t proper t ies of an ion c ross ing a dee gap to be evaluated to high accuracy without numerical in tegrat ion through the e l e c t r i c f i e l d . The accuracy of the method is given as a funct ion of RF phase and incident ion energy. This approximation is used in the t racking of the radia l motions in Chapter h between 5 and 20 MeV where th is approximation is very accura te . B. The TRIUMF Cyclotron The studies descr ibed in th is thes is were performed for the TRIUMF c y c l o t r o n , 6 which because of i ts unique design has several spec ia l problems. The TRIUMF cyc lo t ron is a six-sector,;az"imuthal 1 y varying f i e l d (AVF), isochronous machine, designed to acce le ra te 100 uA of H" ions to 500 MeV. The a c c e l e r a t i o n of H" ions provides a convenient method of ex t rac t ion by s t r i p p i n g two e lec t rons from the H" ions by passing the beam through a th in f o i l . This method gives an ex t rac t ion e f f i c i e n c y of nearly 100% whereas conventional proton machines' have not achieved e f f i c i e n c i e s greater than 80% with a large duty c y c l e . Two other advantages of ex t rac t ion by e l e c t r o n -s t r i p p i n g are v a r i a b i l i t y of ex t rac t ion energy by .ad jus t ing the f o i l p o s i -t ion and simultaneous ex t rac t ion of several beams at d i f f e r e n t energ ies . 4 The disadvantage of th is technique is that the l i f e t i m e of the H" ions requires that the maximum magnetic f i e l d that the ions pass through i" must be low (5.7 kG at 500 MeV) 7to prevent d i s s o c i a t i o n of the H" i ons , and a lso there must be a vacuum < 7 x 10~ 8 Torr to prevent H" s t r i p p i n g by residual gas molecules. The low magnetic f i e l d means that the radius of the machine is very large (500 MeV o r b i t radius of 311 i n . ) , and the centra l magnetic f i e l d (3.0 kG) is f i v e or s i x times lower than in conven-t ional c y c l o t r o n s . The a c c e l e r a t i n g vol tage is provided by four resonant c a v i t i e s which provide 0.4 MeV energy gain per tu rn . The low magnetic f i e l d means that the ion rota t ion frequency is low (4.53 MHz). To al low the cav i ty resonators to f i t inside the vacuum tank, the RF is operated at the f i f t h harmonic of the ion frequency. The fact that the a c c e l e r a t i n g s t ructures are cav i ty resonators means that some th i rd harmonic of the ion frequency can be i n t r o -duced into the c a v i t y , squaring the RF waveform and g iv ing s i g n i f i c a n t improvements in o r b i t p r o p e r t i e s . The arrangement of the TRIUMF centra l region is shown in F i g s . 1.1 and 1.2. The centre post is required to support part of the weight of the upper magnet c o r e s , the magnetic force between the magnet pole pieces and the atmospheric load . The H" beam is produced in an external (Ehlers) ion source and accelerated to 300 keV before being transported to the cyc lo t ron and bent into the median plane by the s p i r a l e l e c t r o s t a t i c i n f l e c t o r . The beam leaves the centre post at the " i n j e c t i o n gap", which provides an a u x i l i a r y 100 keV (the dee-to-ground potent ia l ) a c c e l e r a t i o n on the f i r s t turn . The beam then s p i r a l s outward, gaining a maximum of 400 keV per tu rn . Several types of operat ing condi t ions must be cons idered . One of the p r i n c i p a l uses of the machine w i l l be to produce mesons. In th is case , the 5 current required is l a r g e , but the energy reso lu t ion is not important (since the mesons are produced in a secondary t a r g e t ) . There fore , the duty cyc le may be maximized at the expense of energy r e s o l u t i o n . It is a lso planned to produce a high reso lu t ion proton beam. In th is c a s e , high current is not required so a smaller duty c y c l e may be cons idered , g iv ing smal ler rad ia l o s c i l l a t i o n amplitude a n d t h u s improving energy r e s o l u t i o n . It is a lso hoped that with the add i t ion of th i rd harmonic to the RF, separated turn a c c e l e r a t i o n w i l l be p o s s i b l e , i . e . spa t ia l turn separat ion w i l l be maintained out to ex t rac t ion so that the beam can be extracted from one t u r n , g iv ing very high energy reso lu t ion (hopefu l ly , ±50 keV) . Aga in , the phase band accelerated would <fc^e qui te narrow. C. Equations of Motion The force on a charged p a r t i c l e moving in e l e c t r i c and magnetic f i e l d s is given by the sum of the Lorentz and e l e c t r i c forces F is the force on the p a r t i c l e which has charge q , mass m and v e l o c i t y The e l e c t r i c f i e l d is E and the magnetic f i e l d is B. We def ine a Cartesian co -ord ina te system with the z axis upwards in the ax ia l d i r e c t i o n (perpendicular to the plane of the o r b i t s ) , the x d i r e c t i o n is along the c e n t r e l i n e of the dee gap, and y is perpendicular to the dee gap and the ax ia l d i r e c t i o n . In a Cartesian system, e q n . ( l . l ) can be wr i t ten ~F = q CE + v" x "B) 'I (1 .1 ) (1 .2 ) v B ) X z (1 .3 ) F 2 = q E + (v B - v B ) z x y y x ( 1 . 4 ) The ion c i r c u l a t e s i n i t s o r b i t near t h e x-y p l a n e ; hence the compon-e n t s o f the v e l o c i t y i n t h i s p l a n e (v and v ) a r e much l a r g e r than v . Due ' r x y 3 z t o t h e symmetry o f the magnet, the m a g n e t i c f i e l d i n t h e median p l a n e i s i n the a x i a l d i r e c t i o n o n l y , i . e . B = B = 0 . E r r o r s i n the c o n s t r u c t i o n o f ' x y the magnet may cause the m a g n e t i c median s u r f a c e t o be d i f f e r e n t from t h e g e o m e t r i c median p l a n e , g i v i n g n o n - z e r o v a l u e s o f B^ and B^ i n the g e o m e t r i c median p l a n e ; however, t h e s e w i l l be s m a l l , and we may w r i t e eqns. (1.2) and (1.3) as ^•(mv x) = q ( E x + v y B z ) , (1.5) ^ r ( m v y ) = q ( E y - v x B z ) . (1.6) Eqns. (1.5) and (1.6) a r e re 1 a t i v i s t i c a 1 1 y c o r r e c t , p r o v i d e d the changes i n mass due t o a c c e l e r a t i o n a r e not n e g l e c t e d . The r e l a t i v i s t i c mass i s m = Y m where m i s the r e s t mass and Y i s the u s u a l r e l a t i v i s t i c f a c t o r o Y = 1 + m„c^ 1 where T i s the k i n e t i c e n ergy o f the i o n , c i s the v e l o c i t y o f 1 i g h t and 8 = v / c . The a p p r o x i m a t i o n used i n d e r i v i n g eqns. (1.5) and ( 1 . 6 ) , i . e . t h a t terms i n v B and v B a r e n e g l i g i b l e , has removed c o u p l i n q between motion Z y Z X 3 3 > r - a i n the median p l a n e and motion i n the a x i a l d i r e c t i o n , g r e a t l y s i m p l i f y i n g 7 the c a l c u l a t i o n s . The so lu t ions of eqns. (1.5) and (1.6) [obtained by numerical in tegra t ion through r e a l i s t i c e l e c t r i c and magnetic f i e l d s ] are discussed in Chapter k. The ax ia l motion is descr ibed by eqn.(l.A). The terms in B x and cannot be neglected in th is case s ince they are m u l t i p l i e d by the (large) v e l o c i t i e s v and v . It is these terms which descr ibe the ax ia l magnetic x y focusing produced by f l u t t e r and s p i r a l in the magnetic f i e l d when the ion is not in the median plane. The ax ia l motion is discussed in Chapter 3. 8 Chapter 2. - ELECTRIC FIELD CALCULATIONS A. Choice of Method Accurate o r b i t c a l c u l a t i o n s in the centre region require a de ta i led knowledge of the e l e c t r i c and magnetic f i e l d s involved. The magnetic f i e l d can be obtained from measurements on model magnets. The e l e c t r i c f i e l d is produced by complicated e lect rode shapes (see F i g s . 1.1 and 1.2) and hence cannot be ca lcu la ted a n a l y t i c a l l y . There are several methods which can be used to obtain the e l e c t r i c f i e l d in these circumstances: 1) E1ectroconductive analogies in which the potent ia l is obtained by measuring the voltage in a conducting medium surrounding a model of the e l e c t r o d e s . 8 This method y i e l d s po ten t ia ls (in two or three dimensions) with er rors of about 0.3%- 9 2) Numerical so lu t ion of Lap lace 's equat ion. This method y i e l d s potent ia ls with average er rors of 0.1% or l e s s , depending on the time a v a i l a b l e for computation. This method is descr ibed in detai1 below. 3) The induced current method in which a v i b r a t i n g charged probe induces a current in the e lect rodes proport ional to the component of the required f i e l d at the probe in the d i r e c t i o n of v i b r a t i o n of the p r o b e . 1 0 This method gives f i e l d values with er rors of 5.0% or l e s s . k) The magnetic analog in which the components of the magnetic f i e l d are a measure of the corresponding e l e c t r i c f i e l d components. 1 1 Methods 3 and k y i e l d f i e l d values which can be used d i r e c t l y in o r b i t c a l c u l a t i o n s while methods 1 and 2 give potent ia ls which must be numerical ly d i f f e r e n t i a t e d to obtain the f i e l d components. From th is point of view, method 3 or h is more a t t r a c t i v e . However, methods 1, 3 and h require a model- of the e lect rode s t ruc ture to be b u i l t . 9 This means that changes in the e lect rodes require time-consuming and expen-s ive changes in the model. In a d d i t i o n , these three methods involve mechanica l ly -dr iven probes which are subject to alignment e r r o r s . A l s o , these methods use complicated e l e c t r o n i c c i r c u i t s which are subject to d r i f t over long periods of t ime. For these reasons, the numerical so lu t ion of Lap lace 's equation which avoids these d i f f i c u l t i e s is the most a t t r a c t i v e cho ice . Solv ing Lap lace 's equation for a complicated boundary shape is a d i f f i c u l t computational problem; however, the a v a i l a b i l i t y of l a r g e , fas t computers enables large problems to be solved in a reasonable amount of t i me. B. F i n i t e Di f ference Approximation We wish to f ind the e l e c t r o s t a t i c potent ia l <j> which is the s o l u t i o n of Lap lace 's equat ion, i . e . V2<)> = 0 (2.1) within the rectangular p a r a l l e l e p i p e d shown in F i g . 2 .1 . This volume is bounded by the planes x = 0, x = ph, y = 0, y = qh, T = 0, Z' = rh . In the usual problem e i t h e r the potent ia l or i t s de r i va t i ve is known on the surface of the volume ( D i r i c h l e t or Neumann boundary c o n d i t i o n s , respec-t i ve ly ) while the potent ia l is unknown inside the volume. In the problems to be studied here every boundary plane has D i r i c h l e t boundary condi t ions or is a plane of symmetry (described below). In a d d i t i o n , parts of the i n t e r i o r of the volume may have f ixed potent ia l va lues , i . e . the boundary condi t ions may extend ins ide the volume. To solve eqn. (2.1) numerical ly we transform the d i f f e r e n t i a l equation to a d i f fe rence equation and solve for the values of <f> at d i s c r e t e nodes within the volume. F i g . 2.1 shows a rectangular g r id with uniform spacing h 10 in a l l three d i r e c t i o n s . The nodes occur at the in te rsec t ions of the planes x = i h , y = jh and z = kh where i = 0 , 1 . . . p , j = 0 , 1 . . . q and k = 0 . , l . . . r . The number of nodes in the gr id (N) is (p + 1) (q + l ) ( r + 1) To der ive the f i n i t e d i f fe rence approximation, we consider the potent ia l <j>... at some node i j k . Expanding the potent ia l in a Tay lor I J K ser ies at the s i x nodes nearest to i , j , k we obtain • i ± l . j . k = * i j k 1 h 3x h 2 i j k 3 # h 3 i j k 3 x; i j k hi 2k , 3 # , v. j i j k §• -^ 1 i = <().-i ± h Y i , j ± l ,k y i jk 3 £ [9y h 2 i j k f O *\ '33(J>i i j k 3y^J i j k hi 2k i j k <f>. . , , , = < ( > . . , ± h y i , j , k ± l Y i j k 3 z h 2 ( 3 2 c i j k 3 z ' i j k 3z i j k hi 2k /• i. "\ 3 V 3 z L i j k Adding these , we obtain * i +1j k + * ! - l j k + * i j + lk + * i j - l k + * i j k-1 + * i jk+ l = 6 * i j k using (2 .1) and neglect ing terms in h 4 and h igher , we have, + Vv2<f> + ° ( h t t ) ; jk + + *j+i + * j - i + ^k+i + * k - i . (2 .2) = b. .. . i j k [ i n t e r i o r points] [boundary points] In the r ight s ide of eqn. (2 .2) we have abbreviated the notat ion by wr i t ing only those subscr ip ts which are not equal to i , j or k. Eqn. (2 .2) descr ibes a l inear system of N equations which can be wri tten A d = b (2 .3) 11 where A is an N by N matrix conta in ing the c o e f f i c i e n t s of the system, d ; i s a column vector conta in ing the unknown potent ia l values f \ • • i l l d = : and b is a column vector conta in ing the potent ia l values for those nodes which f a l l in the boundaries. Now the so lu t ion of e q n . ( 2 . 1 ) is reduced to the so lu t ion of the l i n e a r system e q n . ( 2 . 3 ) . It should be noted that the order of the system 2 . 3 is equal to the number of nodes in the mesh, which w i l l be of the order of many thousands or m i l l i o n s . Direct methods for so lv ing l inea r systems such as Gaussian e l im ina t ion or use of determinants have two disadvantages in the present case . F i r s t l y , they require that the matrix A be s t o r e d . This is c l e a r l y unnecessary s ince the elements of A can be generated using e q n . ( 2 . 2 ) . Secondly, they require about N3/3 m u l t i p l i c a t i o n s to solve a system of order N. To solve a system with N = 1 0 6 would take 1 0 1 2 sec (many years) al lowing 3 usee per m u l t i p l i c a t i o n . Such a system can be solved in about 2 hours using the i t e r a t i v e method descr ibed below. I tera t ive methods o f f e r two advantages over d i r e c t methods in th is case. F i r s t l y , they require only the current s o l u t i o n vector x to be stored and secondly , they are much more e f f i c i e n t for so lv ing large systems when the c o e f f i c i e n t matrix (A) contains many zero elements. Many i t e r a t i v e methods for so lv ing systems such as 2 . 3 have been developed and studied t h e o r e t i c a l l y . An exce l len t review of the methods a v a i l a b l e is given by Forsythe and Wasow. 1 2 12 The method used here is based on a program developed by 0. Nel s o n . 1 3 > l l + B a s i c a l l y th is program uses successive ov e r - re la x a t ion by points to solve the l i nea r system." This method is appl ied in a manner which allows ex-tremely large problems to be solved using a modest amount of computer memory. The theory of successive o v e r - r e l a x a t i o n by points is reviewed in Appendix A. The important resu l ts are as fo l lows: We s t a r t with an i n i t i a l approximation (usual ly zero) to the potent ia l at each node 4>.9.; then we obtain successive approximations using I j k * i j k - A n • a L n + l . ,n , ,n+l n , ,n+l ' • i j k + o f V l J k + • i - H j k + • i j - l k + • i j + lk + • i j k - l , n 'i j k+1 n i jk (2.k) where the best value of the "over - re laxa t ion f a c t o r " a for the ordinary successive over - re laxa t ion method is given by a, -B 1 + sine 1 -A ' 3 - L - + - L + _ L p 2 q 2 r 2 where cosO = TT 77 . TT c o s - + COS - + COS -p q r = i - 6 I p (2.5) (2.6) So so lv ing the system cons is ts of i t e r a t i n g over the nodes of the mesh in some order , rep lac ing the value of <f> of each node by the values given by eqn.(2.4). The order we sha l l choose i s , g iv ing the i j k values of the point to be i t e r a t e d , * For th is problem i t appears that the Peaceman-Rachford method 1 5 5 gives fas te r c o n v e r g e n c e . 1 6 However, as has been pointed out by Y o u n g , 1 6 i t is d i f f i c u l t to devise an e f f i c i e n t storage scheme which allows the matrix A to be accessed a l t e r n a t e l y by rows and columns. Any increase in conver-gence rate would probably be negated by increased time spent r e t r i e v i n g , the data from the mass storage dev ice . 13 (o,o,o), ( 1 , 0 , 0 ) ... (P,O,O) (b, i jO) • • • (p,I ,6) (p,q,o) (o,o,i) ••• (p.q .O ( 0 , 0 , r ) (p ,q , r ) or the reverse order . It is shown in Appendix A that the convergence of the method is determined by the largest eigenvalue of the matrix A. If the best value of a, i . e . a^, is used, th is eigenvalue is , 1 - s i n Q . „ /X \n = T+sTnT " 1 " 2 V 3 ? + ? = a. 1 (2.7) Values of A. and a, for the problems which are discussed in th is m b v chapter are given in Table I. -The number of i t e ra t ions required to reduce the e r ro r by a fac tor f is approximately n = log f / l o g X^. (2.8) C. Computational Deta i ls The program as descr ibed by Nelson 1 1* used an i t e r a t i o n subroutine coded in FORTRAN. This was rewritten in assembler language g iv ing a fac tor of twelve increase in speed. In a d d i t i o n , the new i t e r a t i o n routine allows the i t e r a t i o n to be done in a l t e rna t ing d i r e c t i o n s . Deta i ls of these changes are given in Appendix C. The advantage in i t e r a t i n g in a l t e rna t ing d i r e c t i o n s is that i t ensures that the e f f e c t of the boundary condi t ions is qu ick ly propagated through the volume. If, for example, u n i - d i r e c t i o n a l i t e r a t i o n was used going from small i j k to large i j k , and a l l boundaries were zero except the plane with the largest k va lue , many i t e ra t ions would be required before 14 TABLE I Largest eigenvalue U m ) and best o v e r - r e l a x a t i o n f a c t o r (o^) f o r various s i z e r e l a x a t i o n problems Problem s ize Total number of mesh points X m a b 32 x 32 x 16 16,384 0.7569 1 • 7569 64 x 64 x 32 131 ,072 0.8841 1 .8841 128 x 32 x 8 32,768 0.6245 1 .6245 256 x 64 x 16 262,144 0.7946 1 .7946 512 x 128 x 32 2,097,152 0.8895 1 .8895 15 the e f f e c t of the boundary at large k would be f e l t at small k. A l te rna t ing the d i r e c t i o n of i t e r a t i o n avoids th is d i f f i c u l t y . The values of the <i>. 's are stored on a mass storage device (tape, I J K d i s c or drum). Subsets of th is tota l "volume" are t ransfer red to core s torage , i tera ted over and returned to the mass storage dev ice . To increase e f f i c i e n c y (by decreasing the number of data swaps) several i t e ra t ions are done over each subset of the tota l volume while i t is in core storage. This causes the convergence rate to be very slow; however, the program has a novel f ea ture , described below, which allows good s t a r t i n g values to be found, hence reducing the number of i t e ra t ions requi red. The i t e ra t ions over the subsets of the tota l volume must be done c a r e f u l l y , to avoid d i s -c o n t i n u i t i e s where the edges of these subsets occur . Consider the volume shown in F i g . 2.1 broken into b l o c k s , each block conta in ing 16 x 16 x 8 p o i n t s ; then there are b^ = (p+l ) / l6 blocks along the x c o - o r d i n a t e , ^ 2 ~ ( q + 0 / l 6 blocks along the y co-ord inate and b^ = (r+l)/8 blocks along the z c o - o r d i n a t e . The data area in core storage in which the i t e ra t ions are done (the physical work area) contains a 2 x 2 x 2 block subset of the tota l problem. The i t e r a t i o n is done as fo l lows: The physical work area is loaded s t a r t i n g at block co-ord inates (1,1,1) and then i t e r a t e d . During th is i t e r a t i o n a l l po ten t ia ls on the boundaries of the physical work area are held f ixed except boundaries which are symmetry planes of the tota l volume. The next load o r i g i n is (2 ,1 ,1 ) , and th is i t e r a t i o n is repeated. Since two blocks along each co-ord inate are i tera ted each time while the increment between i t e ra t ions is one b lock , d i s -c o n t i n u i t i e s in the data should be reduced. The sequence of load points for the i t e r a t i o n is e i t h e r 16 ( 1 . 1 . 1 ) , ( 2 , 1 , 1 ) . . . . ( b ^ l ,1),(1 ,2 ,1) , (2 ,1 ,1) ( b 1 , b 2 , l ) ( 1 . 1 . 2 ) , ( 2 , 1 , 2 ) . . . . ( b x , l ,2),(1 ,2 ,2) , (2 ,1 ,2) (^,^,2) ( 1 , 1 , b 3 ) ( 2 , l , b 3 ) . . . ( b i , l , b 3 ) , ( l , 2 , b 3 ) , ( 2 , l , b 3 ) . . . ( b 1 , b 2 , b 3 ) or the reverse one (a l ternat ing d i r e c t i o n i t e r a t i o n over the b l o c k s ) . It should be noted that in one sweep over the data using th is pro-cedure 8 ( b l - 1 ) ( b ^ - l ) ( b 3 - 1 ) blocks are i t e r a t e d . On the average, th is is 8 ( b 1 - 1 ) ( b 2 - l ) ( b 3 - l ) ' ( 2 - 9 ) i t e ra t ions over each b lock . The novel feature mentioned above which allows good s t a r t i n g values to be found operates as fo l lows . A f t e r the boundary values have been assigned but before any i t e ra t ions have been done, the mesh s i z e is doubled reducing the problem to one with an eighth as many data points as the o r i g i n a l problem. This process is repeated unt i l the problem s i z e is c lose to the s i z e of the physical work area (32 x 32 x 16 p o i n t s ) . This "reduced" problem is solved i t e r a t i v e l y and expanded back to the o r i g i n a l s i z e prob-lem. During the expansion process , the value assigned to each unknown point is the value for the nearest known node with smal ler or equal i , j and k va lues , i . e . i f <J>. ., is known, the program sets (omitt ing subscr ip ts I J K which are i , j' or k) * i + i = *j+i = * i+ i j+ i = * k + i = ^i+ik+i = V i k + i = - i + i j + i k + i = * • This procedure provides good s t a r t i n g values for the f i n a l i t e r a t i o n . The boundary values are assigned e i t h e r by c a l l i n g a user -supp l ied subroutine which returns the value of the potent ia l at each p o i n t , or by 17 the method given in Appendix B or by a combination of both. In many s i t u a t i o n s , the boundary values at an edge of the problem are not known, but th is edge is a plane of symmetry. In th is case , the program ca lcu la tes the poten t ia ls on the symmetry plane using the fact that the potent ia ls outside i t are the same as those i n s i d e . For example, i f the i = 0 plane were a plane of symmetry, then on th is plane eqn.(2.4) would be ,n+l ,n , a V j k = *0jk 6" H j k + * l jk + C j - l k + •oj+lk + * 0 j k - l + C j k - H When est imat ing the convergence rate for a problem which contains planes of symmetry, i t is important to remember that the er rors are not zero at the plane of symmetry (as they would be i f the plane were a ^ boundary p lane) . Thus the er rors and convergence rates w i l l be those appropriate for the " e f f e c t i v e s i z e " of the prob 1 em, which is the s i z e the problem would be i f the symmetry propert ies were not u t i l i z e d . Thus, i f a problem contains one plane of symmetry, the e f f e c t i v e s i z e is twice the actual s i z e , in genera l ; i f there are n symmetry p lanes , the e f f e c t i v e s i z e is 2 P times the actual s i z e . D. Convergence Tests To test the convergence and accuracy of the method, a problem for which the a n a l y t i c so lu t ion was known was solved using the re laxat ion method. The problem is the one used by D. Nelson 1 3 as a test case; i t con-s i s t s of a 64 x 64 x 32 point "box" with boundary values of zero on a l l sides except the k = 32 surface where the potent ia l is 18 V = s in 2TT i 2nj 64 s i n 64 V. J The sequence of operat ions ca r r i ed out in so lv ing th is problem is gi ven i n Table 11. The f i r s t question which must be answered is how many i t e ra t ions are required on the reduced problem. To answer t h i s , several runs were done. For each run n sweeps were done with a = 1.5, n with a = 1.3 and n with a = 1.0 (a total of 3n sweeps). The value of a used was reduced from 1.5 (c lose to the best value) to 1.0 to ensure that the d i f f e rence equations are solved as exact ly as poss ib le when the i t e ra t ions are f i n i s h e d . The problem was then expanded to f u l l s i z e , and two i t e ra t ions were done on the f u l l volume. A l l i t e ra t ions were done with a l t e r n a t i n g d i r e c t i o n s . The resu l ts are summarized in Table.-| IT. In a l l cases the e r ro r is very s m a l l . Since i t e r a t i n g over the small volume is r e l a t i v e l y f a s t , there is no large penalty paid for over -est imat ing the number of i t e ra t ions requ i red , and n = 100 was chosen. For th is case (n = 100), the average change per i t e r a t i o n before expanding was < 10"6, i . e . the reduced problem had been solved exact ly to the p r e c i s i o n of the ar i thmet ic used. Thus the e r ror of 0.25% a f te r expanding is due to the expansion process. Now the problem was expanded back to f u l l s i z e 64 x 64 x 32 p o i n t s , and the convergence of th is problem was inves t iga ted . Since we are doing the i t e ra t ions over subsets of the problem each conta in ing 32 x 32 x 16 p o i n t s , the best value of a i s , from eqn.(2.5), = 1.75. Two other values of a were used, 1.87 because th is is for a problem conta in ing 64 x 64 x 32 points and 1.50 for reasons discussed below. F i g . 2.2 shows the average e r ror as a funct ion of the number of i t e ra t ions for these values of a. The discrepancy in the e r ro r a f te r two i t e ra t ions over the 19 TABLE I I Sequence of operat ions used to solve a 64x64x32 node re laxat ion problem Step Operat ion Problem a f t e r th s ize s step Number of i terat ions Average change per i t e r a t i o n 'after , this step 1 set boundary condi t ions 64 X 64 X 32 -2 reduce to coarse gr id 32 X 32 X 16 - -3 i terate (a = 1 .5) 32 X 32 X 16 100 0.9 x 1 0 - 3 4 i te ra te (a = 1.3) 32 X 32 x 16 100 0.6 x 10" 5 5 i te ra te (a = 1 .0) 32 X 32 X 16 100 0.5 x 10" 6 6 expand to f i n e g r id 64 X 64 x 32 - 1 7 i terate (a - 1.5) 64 X 64 x 32 see F i g . 2.3 see F i g . 2.3 TABLE I I I Average er ror a f t e r var ious numbers of i t e ra t ions over the reduced problem Case n Average e r ror {%) 1 25 0 .40 2 50 0.30 3 75 0.31 4 100 0.25 5 200 0.28 20 f ine gr id between Table II and F i g . 2.2 is due to d i f f e r e n t i t e r a t i o n d i r e c t i o n s where i t e r a t i n g over the f i n e g r i d . As expected, a = 1.75 produces the fas tes t convergence, but the convergence is s a t i s f a c t o r y in a l l three cases . Eqn. (A.23) p red ic ts that the number of i t e ra t ions required to reduce the er ror by a fac tor f is n = ^ . The value of appropriate to a = 1.75 is 0.75; hence the number of i t e ra t ions required to reduce the er ror by a fac tor of 10 is —^—j^y = 8.0 . As can be seen from F i g . 2 .2 , about 40 sweeps over the data are required to achieve the same reduction (a = 1.75). Since the problem contains 4 x 4 x 4 blocks of da ta , by eqn. (2 .9 ) , each sweep corresponds to 8(4-1) (4-1) (4-1) _ (4) (4) (4) " 3 - 3 7 5 -i t e r a t i o n s . Hence the 40 sweeps correspond to 135 i t e r a t i o n s , ind ica t ing that the convergence is about s ix teen times slower than the t h e o r e t i c a l l y expected rate for ordinary success ive o v e r - r e l a x a t i o n . This slow conver-gence rate is probably due to the way in which the i t e ra t ions are done, i . e . many i t e ra t ions over a small subset of the tota l volume. However, with the good s t a r t i n g values provided by the reducing and expanding procedure, the convergence of the problem is acceptab le . For p r a c t i c a l problems i t has been found by the author and by D. N e l s o n 1 3 that a = 1.5 gives the best r e s u l t s . This is probably due to the fact that , in p r a c t i c a l c a s e s , f i xed points occur wi thin the volume. This means that the "wavelength" of the er rors w i l l be smaller than that assumed in eqn.(A.8), leading to smal ler values of a^. Since a = 1 .5 seemed to be best for " r e a l " problems and s ince a = 1.5 s t i l l gives acceptable convergence for the test problem, only th is value was studied fu r the r . 21 F i g . 2.3 shows the average e r ror and the average change per i t e r a t i o n for the a = 1.5 case . The bars on the points g iv ing the average e r r o r indicate the e r ror at which the number of points vs e r ro r curve ( F i g . 2.4) has f a l l e n to ha l f i ts peak va lue . As we would expect , s ince we are using a > 1, the change per i t e r a t i o n is always larger than the e r r o r . Of course , there may be a few large local e r rors which do not produce a large average e r ro r. F i g . 2.4 shows the d i s t r i b u t i o n of e r rors for var ious numbers of i t e r a t i o n s . The graph is a c t u a l l y a histogram; the v e r t i c a l l ines give the (approximately equal) in te rva ls in which the numbers of points are counted. Several points are worth not ing . Even a f te r many i t e r a t i o n s , about 0.04% of the points have er rors larger than 5.0%, despi te the average e r ro r being less than 0.04%. It appears that th is s i t u a t i o n w i l l not change s i g n i f i -cant ly even i f many more i t e ra t ions are done. It seems that the large er rors must be removed before the smal ler ones are a f f e c t e d . This is shown more c l e a r l y in F i g . 2.5 where the number of points with a given e r ror is p lo t ted as a funct ion of the number of e r r o r s . It can be seen that the number of points with small e r rors remains r e l a t i v e l y constant un t i l the number of large er rors has been reduced. E. The P r a c t i c a l Problem Problems which are useful in p rac t i ce usua l ly contain many more points than the case discussed in Sect ion D. The same reducing and expand-ing procedure is fo l lowed, so that the s t a r t i n g values for the i t e r a t i o n s on the large problem:-are qui te good. However, s ince the number of points is l a rger , the convergence w i l l be slower (as predicted by eqn.(A.22)) and each i t e r a t i o n w i l l take longer. 22 The p r a c t i c a l case discussed here is a 128 i n . by 32 i n . by 8 i n . sect ion from the centre of the TRIUMF c y c l o t r o n . The 8 i n . dimension is in the axia l d i r e c t i o n and extends from the cyc lo t ron median plane to the vacuum tank. The 128 i n . dimension is along the dee gap, and the 32 i n . dimension is perpendicular to the dee gap. The geometry in the median plane and the e l e c t r i c equipotent ia 1s ca lcu la ted using th is method are shown in F i g . 1.1. The geometry in the ax ia l d i r e c t i o n is shown in F i g . 1.2. It was f e l t that a.0.25 i n . g r id s i z e adequately defined the boundaries; hence the problem contained 512x128x32 = 2,097,152 data p o i n t s . The sequence of operat ions used in so lv ing th is problem is given in Table IV. At the end of step 6, the change per i t e r a t i o n at each point is less than 10" 7 , so a f t e r expansion to 256 x 64 x 16 p o i n t s , we would expect the average e r ro r to be about 0.40% as i t was in the test case . The er rors are of course unknown, but the average change per i t e r a t i o n at the beginning of step 8 was about 0.1%. The reason for th is value being smal ler than the value for the test case is probably that there are more f ixed points in the real case . A f te r 75 i t e r a t i o n s over the 256 x 64 x 16 problem, the average change per i t e r a t i o n is less than 10" 6 . The i t e r a -t ions on the f u l l - s i z e problem (step 12) are very c o s t l y s ince we now have over two m i l l i o n data p o i n t s ; however, very few i t e r a t i o n s are requ i red . Step 12 consisted of four i t e ra t ions over the f u l l volume to smooth out any bumps l e f t by the expanding process . The average change per i t e r a -t ion at the end of step 12 was less than 0.01%. Local e r rors w i l l be larger than t h i s , of course. In the test problem the largest er rors were more than 100 times as large as the average e r ro r but only for 0.04% of the p o i n t s ; hence in th is case we can expect local e r rors of the order of 1 or 2% at a very small number of p o i n t s . However, the convergence of the 23 TABLE IV Sequence of operat ions used to solve a 512x128x32 node. re laxat ion problem Step Operat ion Problem s i z e a f te r th is step Number of i terat ions Average change per i t e r a t i o n a f t e r th is step 1 set boundary cond i t ions 512 X 128 X 32 - -2 reduce to coarse g r id , 256 X 64 X 16 - -3 reduce to coarser g r id 128 X 32 X 8 - -4 i terate (a = 1.5) 128 X 32 X 8 100 0.3 x I O - 3 5 i terate (a = 1.3) 128 X 32 X 8 100 <10~ 7 6 i terate (a = 1.0) 128 X 32 X 8 100 < 1 0 - 7 7 expand 256 X 64 X 16 - ? 8 i terate (a = 1.5) 256 X 64 X 16 0.2 x 1 0 _ l + 9 i terate (a = 1.3) 256 X 64 X 16 25 0.2 x 10" 6 10 i terate (a = 1 .0) 256 X 64 X 16 25 0.1 x I O - 6 11 expand to f u l1 s i z e 512 X 128 X 32 - ? 12 i terate (a = 1.5) 512 X 128 X 32 4 < 1 0 - 4 2k 0 problem is very s a t i s f a c t o r y . As can be seen in F i g . 1.1, the equipoten-t i a l s have no unexpected kinks and f i t the boundary condi t ions extremely wel 1 . 25 Chapter 3-. -AXIAL MOTIONS A. Introduction The axia l motions of ions wi th in a cyc lo t ron are inf luenced by three e f f e c t s ; magnetic forces due to s l o p e , f l u t t e r and s p i r a l of the magnetic f i e l d , e l e c t r i c forces due to the lens e f f e c t of the dee gap and space charge forces due to the e l e c t r i c f i e l d produced by the beam. The magnetic fo rce is small and focusing at the centre of the machine. The e l e c t r i c force is very strong and phase dependent ( focusing for some phases and defocusing for o thers ) . The space charge force is weak and always defocus-ing. It w i l l be shown that the ax ia l motions during the f i r s t few turns are c o n t r o l l e d almost e n t i r e l y by the e l e c t r i c f o r c e s . Since one of the main design object ives of TRIUMF is to acce lerate ions over a wide in terva l of the RF waveform ( i . e . ions with large d i f -ferences in the i r i n i t i a l RF phase) care fu l design is required to prevent loss of those ions which s t a r t at unfavourable phases. The improvements which can be achieved by "squar ing" the radio- frequency waveform (by adding a small f r a c t i o n of 3rd harmonic to the fundamental) w i l l be demonstrated. Obviously , the ax ia l displacement of the beam must not exceed the aperture of the dees but a more s t r ingent l im i t on the amplitude of the ax ia l o s c i l l a t i o n is set by the fact that passage of the beam through regions where the forces are not l inear causes d i s t o r t i o n of the beam emittance. This causes a decrease in the " e f f e c t i v e densi ty" of the beam wi th in the e l l i p t i c a l contour enc los ing the beam's phase space. Recent work by H a n 1 7 ind icates that about 60% of the dee aperture is l inear to wi th in 5%.* The axia l motions must be adjusted so that as wide a range * C. Han integrated the equations of motion numerical ly through f i e l d s for three gap geometries. For a gap height of 1.6" and gap widths of 3.0", 6.5", and 7-4", the deviat ions from l i n e a r i t y were less than 5% over 60% of the gap height . 26 of phases as poss ib le is t ransmit ted . In a d d i t i o n , the beam must be matched to the magnetic f i e l d so that the amplitude of the ax ia l o s c i l l a -t ions is minimized. B. Magnetic F i e l d The ax ia l res tor ing force (F ) exerted on an ion by the magnetic f i e l d can be expressed in terms of the ax ia l o s c i l l a t i o n frequency (v ) which an z m ion would have in the absence of other forces in the ax ia l d i r e c t i o n . The o s c i l l a t i o n frequency is re lated to the force by ' 2 F = -m to 2 z o v , z v. J m where io is the ion ro ta t ion frequency. This is a l i nea r approximation v a l i d only for z << g , the magnet pole gap height . In a sector - focused cyc lo t ron the o s c i l l a t i o n frequency is g i v e n 1 8 approximately by v. z 2 = _ y- + F 2 ( , + 2 t a n2 e ) . (3.1) r dB - y ' = g- j-p- descr ibes the radia l v a r i a t i o n in the magnetic f i e l d . The azi muthal v a r i a t i o n of the magnetic f i e l d is described by the f l u t t e r funct ion F 2 where F 2 = ^ ( B - B ) 2 ^ /B2. B is the mean f i e l d at a given radius and the angular brackets denote a mean at one rad ius . Near the centre of the cyc lo t ron the magnetic f i e l d 1 + f cos .6(6-6 ) m where f is is given to a good approximation by B = B the amplitude of the s ix th harmonic component (= B g /B) and 8 m is the azimuth angle of the peak f i e l d . If the azimuthal v a r i a t i o n of the f i e l d is re lated to one harmonic o n l y , the; f l u t t e r funct ion F 2 is related to the amplitude of the harmonic f by F 2 = | f 2 . The angle e is 27 the s o - c a l l e d " s p i r a l angle" defined by tane = rde / d r . For an isochronous m f i e l d , is p o s i t i v e and, near the centre of the c y c l o t r o n , the s p i r a l angle e is ze ro , hence the focusing provided by the magnetic f i e l d is due only to the " f l u t t e r " in the f i e l d . If the net e f f e c t of the magnetic f i e l d is to be f o c u s i n g , the term due to the f l u t t e r must be larger than the defocusing term due to the f i e l d s l o p e . Unfor tunate ly , i t is d i f f i c u l t to obtain large f l u t t e r in the centra l region of a cyc lo t ron magnet because the v e r t i c a l magnet gap is much larger than the hor izonta l d istance between pole p ieces . A t yp ica l p lot of F i g . 3 .1- We plot e \ V 2 2 f \ z rather than m as a funct ion of radius is shown in m is proport ional to m f \ V s i nee V 2 z m the force exerted on the ion . Some cyc lo t rons use a magnetic "cone" in the centra l region to increase focus in g . This cons is ts of a centra l "bump" on the isochronous value of the f i e l d . This means that is negat ive , hence the magnetic focusing is increased. In a d d i t i o n , phase s l i p is introduced due to the fact that the f i e l d is not isochronous. The ions must be s tar ted at p o s i t i v e ( late) phases so that they have s l ipped into phase by the time they have reached the isochronous f i e l d reg ion. The p o s i t i v e phase h i s t o r i e s are advantageous from the point of view of e l e c t r i c focus ing . In the absence of "squar ing" of the RF, i t w i l l be shown that the phase acceptance has a sharp cu to f f at -5 deg, i . e . , only phases more p o s i -t i ve than th is can be accepted. A small f i e l d bump could be used to s h i f t these p o s i t i v e phases into isochronism so that the range of phases which is accelerated is centred about 0 deg. It is shown in Sect ion H of th is chapter that th is f i e l d bump does not contr ibute appreciably to the f o c u s i n g . A f i e l d bump w i l l not be required when add i t ion of t h i r d harmonic to the RF s h i f t s the lower l im i t of the phase acceptance from -5 deg to -25 deg. F i e l d bumps are undesirable for three reasons. 28 F i r s t l y , the ions s t a r t o f f phase and s ince the er ror in centr ing depends on the cosine of the largest phase ang le , the centr ing er rors are i ncreased. Secondly, s ince the ions s ta r t o f f phase the energy gain is reduced. Because of the r e l a t i v e l y high in jec t ion energy, th is makes the clearance between the centre post and the beam small on the f i r s t tu rn . T h i r d l y , the f i e l d bump w i l l cause the beam to pass through the v r = 1 resonance (when y" - 0) poss ib ly leading to an increase in the rad ia l o s c i l l a t i o n ampli tude. Another way to increase the focusing is to increase the f l u t t e r . This may be achieved by cu t t ing three of the pole pieces at a radius of 30 i n . , g iv ing a three -sector geometry in the centra l region. This produced a of about 0.2 from r = 10 i n . outwards; however, the large f l u t t e r with t h r e e - f o l d symmetry caused undesirable e f f e c t s in the radia l behaviour of the beam (see Chapter k) and had to be abandoned. Tests have a lso shown that a set of " f l o a t i n g " pole pieces 1.66 i n . above and below the median plane between 12.5 i n . and 30.0 i n . r a d i u s , with s i x - f o l d symmetry, can a lso provide However, i t is v i r t u a l l y impossible to mount pole pieces in such a p o s i t i o n without d is turb ing the alignment of the resonator hot arms. At th is time i t seems that the best magnetic focusing that can be achieved is that shown by the s o l i d curve in F i g . 3.1. C. Space Charge Forces The ions in the beam produce an e l e c t r i c f i e l d which exerts a force on each ion in the beam. This is the space charge e f f e c t . This e f f e c t can be analyzed by cons ider ing the force on an ion on the surface of a bunch v z V. J - 0.2 in the centra l region. m 29 due to the other ions in the bunch and the force due to the ions in other bunches. Reiser has analyzed th is problem; we f ind for the case of TRIUMF (400 kV voltage gain per turn and low magnetic f i e l d ) that at low energy, more than 30% of the space charge force on an ion is due to the f i e l d produced by the other ions in the bunch. This force is d i rec ted r a d i a l l y outward from the centre of the bunch and can be w r i t t e n 1 9 F = ,,q T, G. 1 m 4e0A<}>vz. where and A<|> are the maximum height and the length of the bunch in degrees of RF, r e s p e c t i v e l y , v is the v e l o c i t y of the i o n s , I is the average c u r r e n t , q is the charge on the i o n , E q is the p e r m i t t i v i t y of f ree space, and G is a fac tor which depends on the he ight - to -width r a t i o of the beam bunch. The v e r t i c a l o s c i l l a t i o n frequency produced by th is force is v 2 4e mw2 z i 2 A<j> v • V J ; sc o m In the case of TRIUMF, the source w i l l produce about 2 mA, hence without bunching we can expect I/A<j> = 5 yA/deg. Since the ax ia l focusing is four or f i v e times weaker than the radia l f o c u s i n g , we can expect beam wid th - to -height ra t ios of the order of 0 .5 . For th is va lue , the geometrical fac tor G is 4 .8 . F i g . 3-2 shows how of I/Ad) and z . m f \ v 2 z var ies with energy for var ious values sc A graph showing the v a r i a t i o n of G with the gap and height of the dee 19 can be found in the paper by Re iser . This force is roughly the same order of magnitude as the magnetic force and can be accounted for by using an " e f f e c t i v e " magnetic v 2 which 30 is the d i f f e rence between the actual magnetic and the space charge for the beam in tens i ty under c o n s i d e r a t i o n . D. E l e c t r i c Lens E f fec ts The importance of e l e c t r i c focusing e f f e c t s in cyc lot rons was recog-nized soon a f t e r the invention of the c y c l o t r o n . Rose 1 developed approximate expressions for the lens e f f e c t s of cyc lo t ron dee gaps using the symmetry propert ies of the e l e c t r i c f i e l d s and a descr ip t ion of the f i e l d derived by K o t t l e r . 2 0 These studies indicated that the lens prop-e r t i e s arose from two e f f e c t s . As can be seen in F i g . 3-3, the f i r s t part of the gap is f o c u s i n g , while the second part is de focus ing . These would cancel e x a c t l y , except that (i) the f i e l d is changing, and ( i i ) the ion is acce le ra ted . The d e f l e c t i o n due to the f i e l d v a r i a t i o n a r i s e s because the ion sees a d i f f e r e n t e l e c t r i c f i e l d in the second ha l f of the gap than in the f i r s t . Since the f i r s t ha l f of the gap is focusing and the second ha l f is defocus-ing , there is a d i f f e r e n t i a l focusing e f f e c t . The change in T' = dz/dx due to th is " f i e l d v a r i a t i o n " e f f e c t i s , to f i r s t order in qV / E ' ^ o c ( A z ' ) f v = - ^ f 7 z s in <j>b (3.3) where V q is the dee voltage and E c > r and <|>c are the energy, radius and RF phase of the ion at the gap cent re . This e f fec t is l inear in z and is focusing when the f i e l d is f a l l i n g (pos i t i ve phases) but defocusing when the f i e l d is r i s i n g (negative phases) . The second e f f e c t is due to the ion spending less time in the second ha l f of the gap, hence the defocusing force in the second ha l f of the gap 31 produces less d e f l e c t i o n than an equal force would in the f i r s t h a l f . This e f f e c t is always focusing and is given by (Az') ec Z COSZ(j> • (3.4) where g is a numerical fac tor depending on the geometry. There is a lso a c o l l i m a t i o n term due to the fact that the forward momentum p x increases while the transverse momentum p z remains constant ; however, th is term disappears when the change in p 2 rather than z ' is cons i dered. In a d d i t i o n , Rose pred ic ts a change in ax ia l p o s i t i o n Az = 1 -qV coscj) (3.5) Rose's ana lys is was extended by Cohen 3 who used an e l e c t r i c f i e l d developed by Murray and R a t n e r . 2 1 This more de ta i l ed ana lys is showed that the expressions developed by Rose are the f i r s t two terms in a ser ies in / l / E c . More r e c e n t l y , the ana lys is has been fur ther extended by R e i s e r . 2 2 This most recent ana lys is includes the e f f e c t of the dee l i n e r , i . e . , c is not 0 0 (see F i g . 3-3) as was assumed in the previous ana lyses . R e i s e r ' s expression for the d e f l e c t i o n is Az" = - z . f , N r Er J s i nt))c + 2 F ( a ,b ,c ) f q V ' irb cosz<j>f S^o cos<j,cz- (3.6) where Z q is the ax ia l displacement of the ion when i t enters the l e n s , N is the harmonic ra t io of the RF frequency to the ion frequency and F (a ,b ,c ) is a dimensionless funct ion which depends on the geometry (a, b and c are described by F i g . 3-3). 32 The l i n e a r i t y in z of the above expressions for the d e f l e c t i o n and displacement permits an enormous simplif ication in the axia l motion c a l c u l a -t i o n s . However, th is formula is based on the assumptions that the t r a n s i t time of the p a r t i c l e across the gap is small and that the energy gain across the gap is much smaller than the incident ion energy. Since the e l e c t r i c forces become strong jus t where these approximations are l i k e l y to become i n v a l i d ( i . e . at low energy) , i t is important to invest igate the v a l i d i t y of th is formula. For the case of TRIUMF, the RF operates at the f i f t h harmonic of the ion frequency (N=5) and the t r a n s i t times are of the order of 60 to 70 deg of RF on the f i r s t turn so the small t r a n s i t time approx i -mation is not v a l i d ; however, the r e l a t i v e l y high in jec t ion energy (300 keV) means that the approximation that the energy gain is small com-pared to the incident energy is reasonably v a l i d a f te r a few a c c e l e r a t i o n s . Recent ly , H a n 2 3 has publ ished a compi lat ion of the focusing e f f e c t s of cyc lo t ron l i k e gaps for geometries app l icab le to TRIUMF. These resu l ts were obtained by numerical ly in tegrat ing the equations of motion through e l e c t r i c f i e l d s ca lcu la ted using the re laxat ion method described in Chapter 2. The data given in Han's Tables 6-1 to 6-7 provide a relevant source of numerical resu l ts to compare with the theory. To allow compari-son of the e l e c t r i c forces to the magnetic and space charge f o r c e s , we can approximate the focusing e f f e c t s at the dee gaps by an equivalent which would give the same d e f l e c t i o n over a h a l f - t u r n . ( \ v2 z I f A z ' << z /-rrr 0 2 ^ d 2 z d 2 z 1 A f d z l V Z Z = 7T = , „ = ;—7T = — A ma) 2 o 2 d t 2 d e 2 TT Ide. = Az' 33 For the numerical resul ts given by Han 2 3 -v 2 z r F2 where F^ is the forward focal power of the l e n s . F i g . 3.4 compares values of v 2 z obtained by exact numerical integra e t ion with those obtained from eqn.(3.6) for var ious phases and energ ies . The agreement is better for negative phases than for p o s i t i v e ones. In a l l cases the a n a l y t i c d e s c r i p t i o n given by eqn.(3.6) overestimates the strength of the e l e c t r i c f o r c e s . It should be noted that for TRIUMF the i n j e c t i o n energy is 300 keV, and the ion energy a f t e r the f i r s t main gap cross ing is about 600 keV, so the approximation is v a l i d to wi th in 15% in the f i r s t turn . Hence we can use the expressions given in eqns. (3-5) and (3.6) and obtain a reasonable estimate of the ax ia l motions. It should be noted that the e l e c t r i c forces are much larger than the magnetic and space charge f o r c e s . In a d d i t i o n , the e l e c t r i c forces are defocusing f o r , roughly speaking, negative phases. This causes a sharp cu to f f in the phase acceptance near 0 deg. This cu to f f can be s h i f t e d to more negative phases by provid ing add i t iona l ( for example, magnet ic)^ f o c u s i n g . To s h i f t th is cutof f to -30 deg at 500 keV, magnetic focusing equivalent to a ing e f f e c t s of the e l e c t r i c f i e l d . This sharp cutof f for negative phases is due to the f i e l d v a r i a t i o n e f f e c t . The d e f l e c t i o n due to f i e l d v a r i a t i o n is proport ional to sintfi, hence rap id ly becomes large for negative phases. The . focus ing due to the energy change is proport ional to cos2<j> and is m u l t i p l i e d by a smal ler c o e f f i c i e n t than the f i e l d v a r i a t i o n term. The r e l a t i v e magnitude of these two e f f e c t s is shown in F i g . 3-4. The maximum cont r ibu t ion to ' 2 V z of (0.3) would be required to overcome the defocus-m 3h (v^)2- from the energy change term is given by the curve for <j> = 0. Hence the net e f f e c t of the e l e c t r i c f i e l d c l o s e l y fol lows the f i e l d v a r i a t i o n e f f e c t and is defocusing for negative phases. E. Ca lcu la t ion of Cyclotron Acceptance Since the l i n e a r d e s c r i p t i o n of the e l e c t r i c lens e f f e c t is reasonably accura te , and the magnetic and space charge focusing can be described in a l i n e a r manner, we can track the axia l motions of the ions using the matrix method for t racking beams as suggested by Penner. 2 * 4 If the ax ia l focusing frequency due to the combined e f f e c t s of the magnetic f i e l d and space charge is v , then in a region where is constant , the ax ia l motion w i l l be given by (s) = z 0 cos v 9 + r z ° ^ s in v 6 (3-7) z v z z z ' ( s ) = - v z z o s in v z 6 + za' cos v_ where z^ and z ' are the i n i t i a l (axial ) displacement and s l o p e , respec-t i v e l y , 9 = s / r is the azimuthal angle subtended by the ion , s is the path length , and r is the radius of curvature of the ion . We are deal ing with low energies so we can use a n o n - r e l a t i v i s t i c energy - momentum r e l a t i o n s h i p Z' = W (3-8> where p z is the axia l momentum, E is the k i n e t i c energy and k = /2m Q . It is convenient to measure momenta as Bvr where 8 and v are the usual r e l a t i v i s t i c factors and r^ is the "cyc lo t ron radius" (= m Q c / q B c ) . This momentum! is numerical ly equal to the radius of curvature the ion would have in the central magnetic f i e l d (B c) . For the TRIUMF centre region 35 B c = 3.0 kG, &yra ( in . ) = 18.94 / E (MeV). Using e q n .(3.8), we can wri te the magnetic t ransfer matrix r z Pz k V. J cos V v 7 / E s in v. , / E . s in v 0 cos v z t P IU J Pz k (3-9) The expressions given in eqns.(3-5) and (3-6) can a lso be wr i t ten in th is form. If we c a l l the t ransfer matrix for the dee gap b d then a = 1 qV 2- cos d> 0«c S I " Y + i E \. C J COS2(J> (3.10) (3.11) where E c and E^ are the ion energies at the centre and end of the dee gap, r e s p e c t i v e l y . The expressions derived by Rose and Cohen do not include any depend-ence of the f i n a l pos i t ion on the i n i t i a l d ivergence, i . e . b is assumed to be zero . The numerical resu l ts given by Han ind icate d = 1 , and s ince L i o u v i l i e ' s Theorem required ad - cb = 1 , we choose d = 1 b = - ( ad - 1) . c (3.12) (3.13) The fac t that b is non-zero means that there is a displacement term which depends on the i n i t i a l slope (z-^) . The ex is tence of th is term is confirmed in the numerical resu l ts given by Han; however, i t is a small e f f e c t . 36 Now that the t ransfer matrices for the various parts of the t ra jec tory are known, the complete t ra jec tory can be c a l c u l a t e d by the usual matrix m u l t i p l i c a t i o n method e \ Z 2 z l P z 2 P z l k V J k J ' *\ Z 3 r \ Z 2 P * 3 I k , P * l { k J z 3 z l P z 3 • V i P z l l k J { k J A method for analyz ing o p t i c systems, much more powerful than t r a j e c -tory t r a c k i n g , has been developed by S t e f f e n . 2 5 This method allows the t rack ing of e l l i p t i c a l beam phase space areas through the system. It is usual to consider e l l i p t i c a l emit tances, s ince e l l i p s e s can be s p e c i f i e d by only three parameters, and make a good approximation to the actual phase space shape, which would presumably be p o l y g o n a l . 2 6 We w i l l use S t e f f e n ' s notat ion to descr ibe the phase space e l l i p s e s . I f . the e l l i p s e is descr ibed by the equation 2 yz z + 2 az Pz Pz = e then, as derived by S t e f f e n , the maximum displacement and momentum are z = / e j max 37 If we def ine the t ransfer matrix which transforms the vector z Pz V. J by c s c s then Stef fen shows that the e l l i p s e parameters are transformed according to h = 2^ V J C^ •cc ' -2c'.s cs"+s c - 2 c ' s ' s^ •ss ' ) This allows t racking of the beam e l l i p s e through the system by m u l t i p l i c a -t ion of 3x3 matr ices . Since the e l e c t r i c and space charge forces decrease with increasing energy, the only important focusing force outs ide the centra l region is the magnetic f i e l d . At th is point (where e l e c t r i c forces have become n e g l i g i b l e ) the beam must be matched to the magnetic f i e l d ; that i s , the amplitude of the ax ia l o s c i l l a t i o n s must be minimized and a beam of uniform envelope obtained. For a constant v z - t h e phase space e l l i p s e which m i n i -mizes z is given by max 3 ' a =0 m Y = — — = constant • v_ 'm 38 Once the central region geometry has been dec ided, the t ransfer matrix from in jec t ion to the radius where e l e c t r i c forces are n e g l i g i b l e can be ca lcu la ted (T). Now i f th is matrix is inverted (T-1-), the phase space e l l i p s e required at in jec t ion to provide a beam matched to the magnetic f i e l d is f -\ R o P . 1 3m a. = T I a i m Y ' m Unfortunate ly , due to the fact that the e l e c t r i c forces are phase de-pendent, T- ' -wi l l be d i f f e r e n t for every i n i t i a l RF phase. This means that the required i n i t i a l phase space shape w i l l be phase dependent; however, the i n i t i a l phase space shape cannot e a s i l y be var ied with phase. The best that can be done is to choose the i n i t i a l e l l i p s e shape for one RF phase and accept the fact that for other phases only those ions whose points in phase space f a l l wi thin the chosen e l l i p s e shape w i l l be accelerated with z < z . , , , . This provides a method for c a l c u l a t i n g the phase ideal envelope acceptance of an a c c e l e r a t o r . The e l l i p s e shape required for one phase is chosen as the one to be provided; then the overlap of the e l l i p s e s for other phases with the chosen e l l i p s e gives the acceptance of the acce lera tor for each phase. F. Phase Space Acceptance for Various TRIUMF  Central Geometries and Inject ion Energies Ear ly in the design of TRIUMF i t was necessary to f i x the in jec t ion energy and in jec t ion geometry. The o r i g i n a l suggestion was that the in jec -t ion energy should be 150 keV; however, i t was soon rea l i zed that the strong and phase-dependent e l e c t r i c forces would allow only a poor duty factor for 39 th is in jec t ion energy. Rais ing the in jec t ion energy would a l l e v i a t e th is problem and a lso reduce the spread in o rb i t centre points due to d i f f e r e n t energy gains for d i f f e ren t RF phases, thus improving the radia l beam q u a l i -ty. However, a higher in jec t ion energy makes bunching, chopping and the design of the s p i r a l e l e c t r o s t a t i c i n f l e c t o r more d i f f i c u l t . Thus we must invest igate the axia l motions to determine how the phase acceptance var ies with in jec t ion energy and make a compromise between increased phase accept-ance and the d i f f i c u l t i e s mentioned above. Various i n i t i a l o r b i t geometries had been suggested, ranging from the one in jec t ion gap case shown in F i g . 1.1 to the mult i -gap case shown in F i g . 3-5. At the time of these studies i t was hoped that a three-sector magnetic f i e l d could be used in the central region. Model tests showed that th is three -sector geometry produced a magnetic of about 0.2, and so the ax ia l motion studies were done with this va lue . The th ree -sec tor magnetic geometry was la ter replaced by a s i x - s e c t o r geometry for reasons which are explained in Chapter h. The s i x - s e c t o r geometry produces much smal ler values of at small radius (see F i g . 3-1); however, tests with smal ler v z values show that the conclusions reached here are s t i l l v a l i d even with much reduced values of v . z Most of the geometries studied had posts de f in ing the f i r s t two gaps. It was estimated that these posts would reduce the e l e c t r i c forces by a fac tor of k, and th is is included in the c a l c u l a t i o n s . " For each geometry the t ransfer matrices and the e l l i p s e shapes required at in jec t ion were c a l c u l a t e d . F i g . 3.6 shows the e l l i p s e s " The study by Han Z c S indicates that the presence of posts in the dee gap ac tua l l y reduces the focusing forces by a fac tor of s i x or seven. ko required for one geometry. The cyc lo t ron acceptance was ca lcu la ted as d i s -cussed above. For comparison purposes, the over lap of the e l l i p s e s with the e l l i p s e for 20 deg is used, s ince th is is approximately in the middle of the acceptance interval and gives as good matching with other phases as i s poss i b1e. F i g . 3-7 shows the over lap with the e l l i p s e for a phase of +20 deg for in jec t ion energies of 150, 306 and k72 keV with one 100 keV gap in the f i r s t turn . The sharp cu to f f at about -15 deg is due to the defocusing ac t ion of the e l e c t r i c f i e l d . F i g . 3.8 shows the over lap with the e l l i p s e for a phase of +20 deg for in jec t ion energies of 120, 286 and k5k keV with three 100 keV gaps in the f i r s t tu rn . This geometry gives no s i g n i f i c a n t improvement in the phase acceptance, and the mult i -gap geometry worsens the radia l centre point spread and complicates the resonator des ign; hence mult i -gap geometries were abandoned. The data for the one gap geometries is summarized in F i g . 3-9- The average acceptance (averaged from -30 deg to +60 deg) seemed to f l a t t e n out above 300 keV, and th is seemed to be the highest reasonable energy from the point of view of bunching and i n f l e c t i o n , so i t was decided to ra ise the in jec t ion energy from 150 to 300 keV. Now a f te r i t was decided that a th ree -sec tor magnetic geometry could not be used, the code was rewrit ten to accept a magnetic varying with rad ius , and the c a l c u l a t i o n s for 300 keV in jec t ion energy were repeated using the much smal ler measured on the s i x - s e c t o r magnet model ( F i g . 3.1). F i g . 3-10 shows the acceptance as a funct ion of phase for th is case for var ious choices for the i n i t i a l e l l i p s e . If the 20 deg e l l i p s e is chosen as the ax ia l phase space shape of the beam at i n j e c t i o n , over 30% of the beam would be accepted at phases greater than 10 deg while the f r a c t i o n of 41 the beam accepted would be 64% at 0 deg, 30% at -10 deg and zero for phases less than -10 deg. For th is choice of i n i t i a l e l l i p s e shape the amplitude of the beam envelope does not exceed 0.55 i n . for phases between -10 deg and 60 deg. G. E f fec ts of Third Harmonic in the RF on Axial Motions The unique features of the TRIUMF resonators al low the add i t ion of higher odd harmonics to the fundamental m o d e . 2 7 If the t h i r d harmonic of the fundamental is added, the resonators operate as a 3\/h c a v i t y as well as a A./4 c a v i t y . We now have an RF voltage given by V = V o cos <j> - e cos ( 3 4 > + <5) (3 .U) where e = (amplitude of th i rd harmonic)/ (amplitude of fundamental) and <5 is the phase of the th i rd harmonic with respect to the fundamental. Small p o s i t i v e values of e are required to square or " f l a t - t o p " the fundamental. A f r a c t i o n e = 1/9 produces per fect f l a t - t o p p i n g at 0 deg, while more th i rd harmonic than th is produces a s l i g h t dip in the tota l voltage at 0 deg (see F i g . 3.11). Now we must modify the formulae describing the lens e f f e c t s of the gaps (eqns. 3.10 to 3.13) to r e f l e c t the fact that the a c c e l e r a t i n g vol tage is given by eqn.(3-14) instead of a pure cosine waveform. The f i e l d v a r i a t i o n term given in eqn. (3-3) is e s s e n t i a l l y proport ional to dV/d<f>, i . e . to the rate at which the f i e l d is changing, and the energy change term given in eqn.(3.4) depends on the square of the energy ga in . Hence with the RF voltage given by eqn.(3.14) we'have kl c = •*7 "C J s in (j> - 3e s i n (3<}> + <$) + 2 F ( a , b , c ) TT.b "qvf cos - e cos (3<J> + 6) and a = 1 cos cj) - e cos (3<f> + 6) (3.15) (3.16) [c f . eqns . (3.10) and (3-11) for no th i rd harmonic ] As before , d = 1 b = - (ad - 1) . c The negative l i m i t on the axia l phase acceptance is determined by the most p o s i t i v e phase for which the tota l force ac t ing on the ion is defocus-ing (see Sect ion H of th is chapter ) . The e l e c t r i c force is defocusing due to the f i e l d v a r i a t i o n e f f e c t when the f i e l d is i n c r e a s i n g , s ince the (always focusing) energy gain e f f e c t is much smal ler than the f i e l d v a r i a -t ion e f f e c t . Hence we want to choose e and 6 so that the negative of the slope of the voltage (^v2 due to the f i e l d v a r i a t i o n e f fec t ) _d_ d<J> = +sin d> - 3e s in (3d) + 6) (3 .17) remains p o s i t i v e over as wide a range as. p o s s i b l e . F i g . 3-12 shows -j^-for var ious values of e and 6. The widest in terval where --r— a cp V remains p o s i t i v e is produced by 6 = -10 ± 2 deg and e = 0.15 ± .01; however, when <5 * 0, the presence of the beam causes coupl ing between the f i r s t and th i rd harmonics in the resonators , so that the th i rd harmonic becomes detuned inc reas ing , by a large amount, the power required to maintain the th i rd 43 harmonic vo l tage . These coupl ing e f f e c t s are not yet f u l l y understood, so we w i l l consider two c a s e s , 6 = 0 and 6 + 0 . When 6 = 0 the l i m i t on e is V set by the value which causes --JT d<p to become negat ive; e = 0.17, for example, produces a "hole" in the phase acceptance for 5 deg < <j> < 25 deg V (see F i g . 3-13) due to the fact that —$r d t p is negative there. With 6 4= 0, the maximum value of e which can be to lera ted is e = 0.12 ± .01. The phase acceptance produced by th is value is shown in F i g . 3-14. If we allow non-zero values of 6 , the best choice is 6 = -10 deg, e = 0.15. The phase acceptance for th is case is shown in F i g . 3.15. The optimum values of e and 6 w i l l depend to some extent on the f i n a l d e t a i l s of the magnetic f i e l d , the current being acce lera ted and on the RF system, s ince the amount of power required to keep the peak vol tage at 100 keV increases as e increases; however, the use of th i rd harmonic in the RF appears to s h i f t the cu to f f in acceptance due to e l e c t r i c defocusing from -5 deg to -25 deg. These conclusions are based purely on approximate a n a l y t i c formulae and should be confirmed by numerical o r b i t t r a c k i n g , i . e . by in tegrat ing the equations of motion numerical ly through three dimensional e l e c t r i c and magnetic f i e l d s . H. E f fec ts of F i e l d Bumps By a f i e l d bump we mean here an increase in the magnetic f i e l d above the isochronous va lue . The usual procedure in cyc lo t rons is to make the bump largest at the centre of the cyc lo t ron and decrease with rad ius . This pro-duces add i t iona l ax ia l magnetic focusing due to the negative f i e l d gradient [see e q n . ( 3 . 1 ) ] . In a d d i t i o n , the bump causes the phase of the ions to change, s ince the magnetic f i e l d is no longer isochronous. The change in the sine of the phase angle is given by Smith and Garren 2 8 A (sin <j>) 2iTNq2B C f m0 AE J 6Brdr = 6858 G-in. 2 J 6 B r d r . (3.18) SB is the f ie ld bump, B C is the central magnetic f i e l d , AE is the energy gain per turn, N is the harmonic number, and q and mQ are the ion charge and mass, respectively, and the constant is appropriate to the TRIUMF cyclotron. If SB > 0, the ions "catch up", i .e . positive phase (late) ions (favourable for e lectr ic focusing) are brought into phase as the energy increases and the e lectr ic focusing becomes less important than the magnetic f lutter focusing. In a conventional cyclotron with the RF not operating at a high harmonic of the ion frequency, a carefully chosen f ie ld bump can be of great help in overcoming the e lectr ic forces, since the two effects mentioned above both help to increase the useful phase acceptance. For the case of TRIUMF, the operation of the RF at the f i f th harmonic of the ion frequency means that the e lectr ic focusing is very strong, and the two advantages mentioned above are reduced. For example, a bump of 25 G at 10 in. diminishing to zero at 25 in. gives the required phase shift of about 30 deg and an equivalent v 2 due to the f ie ld gradient of 0.01. As can be seen from Fig. 3-4, however, this is much smaller than the force produced by the e lect r ic f i e lds , and hence would have only a small effect on the phase acceptance. Larger f ie ld bumps cannot be used because (i) they produce more phase s h i f t , causing ions to be shifted to a phase where the e lectr ic forces are defocusing, and (i i ) ions starting at large positive phases wil l not gain enough energy to clear the centre post on the f i r s t turn. A f ie ld bump can, however, be used to shift the range of phases which is accepted (-5 deg to +25 deg) to a range which is centred about 0 deg. T h i s must be done c a r e f u l l y so t h a t none o f the u s e f u l phase range i s s h i f t e d t o a phase where the e l e c t r i c f i e l d i s d e f o c u s i n g b e f o r e the magnetic f o c u s i n g i s s t r o n g enough t o make the t o t a l f o c u s i n g p o s i t i v e . F i g . 3 .16 shows the t o t a l e f f e c t i v e v 2 produced by the magnetic and e l e c t r i c f i e l d s . I t can be seen t h a t the sharp c u t o f f i n phase a c c e p t a n c e a t -5 deg demonstrated i n F i g . 3 .10 i s caused by the f a c t t h a t ions w i t h phases more n e g a t i v e than -5 deg e x p e r i e n c e a f o r c e which i s d e f o c u s i n g a t about 1.5 MeV. S i n c e F i g . 3 .16 shows a t what energy the t o t a l f o c u s i n g becomes p o s i t i v e as a f u n c t i o n o f phase, we can c a l c u l a t e how the phase o f the ions s h o u l d be "programmed" so t h a t the i o n i s brought i n t o i s o c h r o n i s m as soon as p o s s i b l e but not s u b j e c t e d t o d e f o c u s i n g f o r c e s . F i g . 3-17 shows the phase a t which the f o c u s j n g becomes p o s i t i v e as a f u n c t i o n o f e n e r g y . An i d e a l m a g n e t ic f i e l d would produce no phase g a i n o u t t o 1.5 MeV; then i t would cause the phase o f the i o n whose phase was -5 deg a t 1.5 MeV t o become more n e g a t i v e , as shown i n F i g . 3-17- The amount o f phase g a i n d e s i r e d i s d e t e r m i n e d by the phase range t o be a c c e p t e d . I f we aim t o a c c e p t a l l ions w i t h phases between -5 deg and +45 deg, the amount o f phase g a i n i s g i v e n by A s i n <j> where, a f t e r the phase g a i n has taken p l a c e , [ s i n ( - 5 ° ) + A. s i hep] = - [ s u n ( 4 5 ° ) + A s i n * ] . T h i s g i v e s A s i n <p=-0 .31 , and the f i n a l range o f phases i s ± 2 3 - 4 deg. The phase h i s t o r y shown i n F i g . 3-17 i s produced by the A s i n tp shown i n i F i g . 3 . 1 8 . The f i e l d bump r e q u i r e d t o produce t h i s v a r i a t i o n i n A s i n <p i s shown i n F i g . 3 . 1 9 - A bump w i t h such a s h a r p c u t o f f cannot be produced i n p r a c t i c e ; however, a bump w i t h the same SBrdr as the one shown i n J F i g . 3-19»and which s h i f t s the phases no f a s t e r than the bump shown i n F i g . 3 . 1 9 , c o u l d be used. I t s h o u l d be noted t h a t the p o s i t i v e s l o p e o f he f \2-t h i s bump w i l l d e c r e a s e r \i by about 0.005. A n o t h e r d i s a d v a n t a g e i s t h a t m the ions w i l l spend 5 or 6 t u r n s f a r from the optimum phase. T h i s may v z cause a l a r g e s p r e a d i n c e n t r e p o i n t s t o d e v e l o p u n l e s s the r a d i a l s t a r t i n g c o n d i t i o n s a r e c a r e f u l l y chosen. T h i s problem i s c o n s i d e r e d i n Chapter h. Of c o u r s e , w i t h t h i r d harmonic i n the RF, the n e g a t i v e phase l i m i t due t o e l e c t r i c f o c u s i n g i s -25 deg and a f i e l d bump i s not r e q u i r e d . 47 Chapter 4. RADIAL MOTIONS ' A. I ntroduct ion The central region of the cyc lo t ron must be designed with two general ob jec t ives in mind. F i r s t l y , the geometry of the e lect rodes must be arranged so that ions with the desi red range of phases can be accelerated without h i t t i n g the e l e c t r o d e s . Secondly, the centra l region must produce a beam which is centred to wi thin the desi red to le rances . We have shown in Chapter 1 that the motion in the median plane and the ax ia l motion are independent to a good approximation. This chapter w i l l d iscuss motion in the median plane o n l y . F i g . 1.1 is a sect ion through the median plane of TRIUMF. The beam is in jected down the axis of the c y c l o t r o n , then bent into the median plane by the s p i r a l e l e c t r o s t a t i c i n f l e c t o r . The problem of the i n f l e c t o r is discussed e lsewhere . 2 9 We w i l l assume that at the ex i t of the i n f l e c t o r we have a mono-energetic beam whose shape in phase space is a f ree parameter. The fac t that the RF operates at the f i f t h harmonic of the ion frequency allows the " i n j e c t i o n gap" to provide an extra 100 keV a c c e l e r a t i o n on the f i r s t tu rn . This eases the geometrical problems somewhat but causes the co-ord ina te of the o r b i t centre p o i n t , perpendicular to the gap, to vary with phase. Af ter reaching the f i r s t main gap, the ions are accelerated and s p i r a l outward as in an ordinary two-dee c y c l o t r o n . The main geometr i -cal cons t ra in t is c learance of the" centre post on the f i r s t tu rn . Ions more than 45 deg from peak phase w i l l h i t the dee and be l o s t ; however, cent r ing requirements l im i t the acceptable phases to a range smal ler than t h i s . The use of f i f t h harmonic a c c e l e r a t i o n means that t r a n s i t time e f fec ts are la rge . This reduces the energy gain at low energy. To a l l e v i -ate th is s i t u a t i o n , the dee gap is tapered in both the hor izonta l and ax ia l 48 d i r e c t i o n s (see F i g s . 1.1 and 1.2) so that the e l e c t r i c f i e l d s are compressed and the energy gains a r e , i n c r e a s e d . In a d d i t i o n , the in jec t ion gap and f i r s t main gap are defined by posts which compress the e l e c t r i c f i e l d fur ther and decrease axia l focusing e f f e c t s , as described in Chapter 3- These refinements make the geometry qui te complicated and necess i ta te numerical t racking of the o r b i t s at least out to the radius where the taper ends (30 i n . or about 3 MeV) . The o r b i t t racking was done using a s l i g h t l y modif ied vers ion of the computer program PINWHEEL.30 The magnetic f i e l d s were obtained from measurements on a 1:20 model magnet, and the e l e c t r i c f i e l d s were ca lcu la ted using the methods described in Chapter 2. B. Basic Design The f i r s t ion o r b i t in the cyc lo t ron is shown schemat ica l ly in F i g . 4 . 1 . Af ter leaving the i n f l e c t o r the ions t r a v e l , under the ' inf luence of the magnetic f i e l d only and with centre of curvature S , un t i l they reach the in jec t ion gap. At the i n j e c t i o n gap the ions are a c c e l e r a t e d , and hence the centre of curvature changes. In a d d i t i o n , i f the centre l i n e of the in jec t ion gap is at an angle to the beam, the ions are d e f l e c t e d . Since the energy gains and d e f l e c t i o n s are phase dependent, the centre points and rad i i of curvature w i l l be d i f f e r e n t for d i f f e r e n t phases. The ions now t rave l , again under the inf luence of the magnetic f i e l d o n l y , to the f i r s t main gap where they are again a c c e l e r a t e d . Due' to the phase-dependent e f f e c t s at the in jec t ion gap, the radius and RF phase at which the f i r s t main gap is crossed w i l l depend on the i n i t i a l RF phase and so w i l l the centre p o i n t s . In designing the centra l geometry i t is d e s i r a b l e to choose the pos i t ion and o r i e n t a t i o n of the in jec t ion gap so that as wide a phase 49 i n t e r v a l as p o s s i b l e c l e a r s the c e n t r e p o s t on the f i r s t t u r n and i s c l o s e enough t o b e i n g c e n t r e d t o be u s e f u l . As f a r as the placement o f the i n j e c t i o n gap i s c o n c e r n e d , the q u a n t i -t i e s o f i n t e r e s t a r e the r a d i u s , RF phase, energy and a n g l e a t which i o n s w i t h v a r i o u s i n i t i a l phases c r o s s the f i r s t main gap. To get a f i r s t o r d e r d e s c r i p t i o n o f the e f f e c t s we can use the a p p r o x i m a t i o n t h a t the energy g a i n s a r e i n s t a n t a n e o u s and g i v e the io n s 93.0 cost}) keV a t the i n j e c t i o n gap and 174.5 coscj> keV a t the f i r s t main gap. These v a l u e s a r e based on the r e s u l t s o f n u m e r i c a l l y i n t e g r a t i n g i o n t r a j e c t o r i e s through the gaps. We w i l l a l s o use a n o n - r e l a t i v i s t i c e x p r e s s i o n f o r the r a d i u s o f c u r v a t u r e o f the i o n w h i c h , f o r a 3 kG mag-n e t i c f i e l d , i s r ( i n . ) = 0.60 /E(keV) = 18.94 /E(MeV) . (4.1) S i n c e i n most cases we w i l l be i n t e r e s t e d i n d i f f e r e n c e s between ions w i t h d i f f e r e n t phases, we w i l l l a b e l t he i o n whose c e n t r e o f c u r v a t u r e i s ( x c , 0 ) [ i . e . i t s c e n t r e o f c u r v a t u r e i s on the c e n t r e l i n e o f the dee gap] by the s u b s c r i p t 1. We l a b e l an i o n a t some o t h e r phase by the s u b s c r i p t 2 . Q u a n t i t i e s r e f e r r i n g t o the i n j e c t i o n gap a r e f u r t h e r l a b e l l e d w i t h the s u p e r s c r i p t i g , w h i l e t h o s e r e f e r r i n g t o the f i r s t main gap have s u p e r -s c r i p t mg. The geometry o f the o r b i t near the i n j e c t i o n gap and f i r s t main gap i s shown i n F i g . k.]. I f the i o n reaches the i n j e c t i o n gap making an a n g l e 8 to the gap a x i s , then f o r a peak dee v o l t a g e V q an ion w i t h c h a r g e q e x p e r i e n c e s a f o r c e -qVV c o s < j ) 1 ^  cosB a l o n g the o r b i t and a f o r c e -qVV cosd) l^ s i n g p e r p e n d i c u l a r t o the o r b i t . The i n j e c t i o n gap causes a 50 st ra ighten ing or "col 1 imating" d e f l e c t i o n , given by A = tan -1 Ap sing p + Ap cos3. AE , ig • o — cos<j) s i n3 (4.2) where p and Ap are the i n i t i a l momentum and momentum g a i n , r e s p e c t i v e l y . The approximation is v a l i d i f Ap << p. Because of radia l centr ing c o n s i d -e r a t i o n s , two quant i t i es of in terest are the radius and angle at which the ions cross the f i r s t main gap, or the d i f fe rences in these quant i t i es for d i f f e r e n t phases. The length a is given by >2 = r j 2 + r 2 2 - 2 r x r 2 cos ( A 2 - A : ) (4.3) and the angle E by E = s i n -1 (A 2 - A x) I a (4.4) The radius d i f f e rence at the f i r s t main gap (6r) is given by 6r = a C O S ( E - I | J ) - r : + / r 2 2 + a 2 s i n 2 (E-iJ>) (4.5) The angle at which the ions cross the c e n t r e l i n e of the gap is given by C = sin" — sin(E-i|i) i r 2 (4.6) The RF phase at which the ion reaches the main gap is given by <pm9 = *' 9 + 5(* + A 2 - Ax - C) (4.7) 51 The co-ord inate of the centre point perpendicular to the dee gap is given It appears from eqns.(4.2) and (4.5) that i f 3 * 0, the radius and angle at which the ion crosses the main gap can be var ied with phase. This would be useful because i t provides a method of improving the "match" between the o r b i t s t a r t i n g conditions provided by the injection gap and those required for centred o r b i t s . However, because of the pos ts , the i n -j e c t i o n gap acts as a lens (s imi la r in propert ies to the lenses studied in Chapter 3 ) . H a n 2 3 has studied the proper t ies of a lens s i m i l a r to the in jec t ion gap and found that i t is convergent for p o s i t i v e phases and divergent for negative phases. The d e f l e c t i o n s due to the lens e f f e c t s are larger than those produced by p lac ing the i n j e c t i o n gap at an angle to the beam. This e f f e c t has been confirmed by numerical o r b i t tracks through e l e c t r i c f i e l d s with the in jec t ion gap at var ious angles . Since radia l cent r ing considerat ions require rm^ for both p o s i t i v e and negative phases to be less than rm^ for zero phase, s l a n t i n g the in jec t ion gap to the ion path does not improve the cent r ing and w i l l not be considered f u r t h e r . Now with 3 = 0 , eqns.(4.2) to (4.8) are much s i m p l i f i e d and w i l l be stated again: by y c = -a sin(E-ijj) . (4.8) A j = A 2 = 0 a = r - r (cOScj), - COS(j>p) (4.9) l 2 E = 0 6r = a costy - r^  + v / r 2 2 + a 2 s i n 2 ^ (4.10) 52 s in C = _2 1_ s I nip = -- a s i x\ty ( 4 1 1 ) r 2 r 2 y c = ( r 1 - r 2 ) simjj = - r 2 sin C (4.12) sinijj (cosdij - cos(p2) r„ A E ' 9 . 2 Eo <f>mg = <pig + 5^ - 5 C ( 4 . 1 3 ) The s u b s c r i p t o r e f e r s t o q u a n t i t i e s b e f o r e the i n j e c t i o n gap i s rea c h e d . In the c e n t r a l r e g i o n o f TRIUMF the r a d i u s o f c u r v a t u r e i s g i v e n by eqn.(4 . 1 ) . The q u a n t i t i e s A E ' ^ and E q a r e 93 and 300 keV, r e s p e c t i v e l y ; hence the c o n s t a n t a p p e a r i n g i n eqn .(4.12) i s ^-2. ^  ^ = 1.61 i n . 2 Eo The f i r s t o r d e r c h o i c e f o r the a v a i l a b l e parameters i s ty = 36 deg and ty ' g = 0 deg, i . e . the i o n w i t h z e r o phase a t the i n j e c t i o n gap has y = 0 a f t e r the i n j e c t i o n gap. I f we use t h i s geometry, then the c e n t r e p o i n t s p r e d i c t e d by eqn.(4.12) a r e as shown by the s o l i d c u r v e i n F i g . 4.2. The energy g a i n c a l c u l a t e d as 93 cos<p'9 + 174.5 c o s i > m g , wi t h <pm^ g i v e n by eqn. ( 4 .13 ) , i s shown by the s o l i d c u r v e i n F i g . 4 . 3 . As e x p e c t e d , t he c e n t r e p o i n t s f o r a l l ions w h i c h g a i n l e s s e nergy than the ion w i t h z e r o phase l i e above the c e n t r e l i n e o f the dee ( p o s i t i v e v a l u e s o f y ). The asymmetry i n the energy g a i n i s due t o the f a c t t h a t n e g a t i v e phases a r e f a v o u r e d by t h i s arrangement, which d e l a y s a l l non-zero phases. C o n s i d e r two i o n s which reach t he i n j e c t i o n gap w i t h phases <p'g = ±30 deg; t h e energy g a i n s w i l l be i d e n t i c a l h ere but the ion s w i l l a r r i v e a t the main gap a t ±30 deg - 5C, as p r e d i c t e d by e q n . ( 4 . 1 3 ) . S i n c e C i s about -0.55 deg f o r t h i s c a s e , t h e i o n w i t h phase -30 deg a t the i n j e c t i o n gap w i l l r e a c h the main gap'at -27.25 deg, and t h e i o n w i t h phase +30 deg a t 5 3 the in jec t ion gap w i l l reach the main gap at +32.25 deg. The phase at the main gap as a funct ion of phase at the in jec t ion gap for th is case is shown by the s o l i d l i n e in F i g . 4 . 4 . The d i f f e r e n t values of y c for var ious phases are inherent in the use of the in jec t ion gap at an angle to the main gap. This centr ing is unde-s i r a b l e because i t leads to a phase o s c i l l a t i o n . An o r b i t with radius of curvature r and o f f centre by an amount y c must turn through an angle of TT + 2y c/r between dee gap c r o s s i n g s . This means that the ion w i l l a r r i v e at one gap ear ly by 1 0 y c / r deg of RF phase and la te at the next gap by the same amount. F i g . 4 . 5 shows the magnitude of th is phase o s c i l l a t i o n as a funct ion of y c fo r var ious values of r. F i g . 4 . 2 indicates that we can expect values of y c of about 0.10 i n . for an ion with phase of + 3 0 deg. This leads to a phase o s c i l l a t i o n amplitude of 4 deg at a radius of 14 i n . (the radius of the f i r s t tu rn ) . The ex is tence and order of magnitude of these phase o s c i l l a t i o n s are confirmed by the phase h i s t o r i e s shown in F i g . 4 . 6 . These phase h i s t o r i e s are from a numerical ly integrated o r b i t . The +30 deg ion has an o s c i 1 l a t i o n amplitude of about 4 . 5 deg, in good agreement with the expected va lue . The asymmetry between p o s i t i v e and negative phases in F i g . 4 . 6 is probably due to the zero phase ion not being exact ly cent red . The phase o s c i l l a t i o n damps out as the energy (and hence r) increases . The magnitude of the centr ing er rors (and hence the phase o s c i l l a t i o n s ) can be reduced by cent r ing the spread of y c ' s about the c e n t r e l i n e of the dee instead of having a l l the y c of one s i g n , as was assumed for the s o l i d curve in F i g . 4 . 2 . This is achieved by moving the in jec t ion gap c l o s e r to the main gap without changing i ts o r i e n t a t i o n . To centre the spread of y c ' s for a phase interval of ±A<|>, the phase of the ion whose y value is zero is ty, 9 = cos' ' c l (1 + cbsAcf>)/2 ; hence 54 . (PT '9 1 . A<p S , n ^ ~ = 7 f s i n T • { k A k ) So, i f we wanted to centre the Y c ' s for a phase range of ±45 deg, we would choose (pj ' 9 = 31.4 deg. This produces the y c and AE values shown by the dashed l ines in F i g s . 4.2 and 4 . 3 . In order to make y c zero for a phase of 31-4 deg, the in jec t ion gap must be s h i f t e d 0.12 i n . (see F i g . 4.2) c l o s e r to the main gap. The maximum phase o s c i l l a t i o n is now reduced to about ±5 deg rather than +10 deg. The phase change between in jec t ion gap and main gap [given by eqn. (4.13)] is now less than 180 deg; hence we are s h i f t i n g the ions towards negative phases for ions with |<p'g| < 31.4 deg where they tend to be defocused in the axia l d i r e c t i o n on subsequent tu rns . In fact i t is useful to reduce the angle ty ( i . e . rotate the in jec t ion gap towards the main gap about the centre point for <j>1). This reduces the energy spread for p o s i t i v e phases; for example ty = 32 deg produces the energy gain curve given by the dotted l ine in F i g . 4 . 3 . The maximum is s h i f t e d towards p o s i t i v e phases because reducing ty reduces [see eqn. (4.13)]; hence p o s i t i v e phases gain more energy. The reduced energy spread a l l e v i a t e s the problems of centr ing and c l e a r i n g the centre post on the f i r s t tu rn . However, as can be seen from eqn. (4 .13) and the dotted curve on F i g . 4 . 4 , reducing ty to 32 deg causes a large phase s h i f t (about 23 deg) towards negative phases. The small s h i f t towards negative phases required to centre the spread of y. 1 s is t o l e r a b l e , s ince i t produces a large improvement in the c e n t r i n g ; however, reducing ty t o , say , 32 deg pro-duces an unacceptably large s h i f t towards negative phases. Hence ty must be chosen so that the ion with phase <P 1 ' g [see eqn. (4.14) ] has y c = 0 a f te r passing through the in jec t ion gap. The radius of the in jec t ion gap 55 is f ixed because the in jec t ion energy is f i x e d ; hence the in jec t ion gap p o s i t i o n is determined. C. Problems with Three-Sector Magnetic F ie lds As demonstrated in Chapter 3, the lower l i m i t on the phase acceptance is set by axia l focusing requirements. The acceptable range of phases can be increased i f a phase-independent focusing force can be found to counter -act the defocusing e f f e c t s of the e l e c t r i c f i e l d . The only phase-independent source of ax ia l focusing is the magnetic f i e l d ; hence e f f o r t s were made to increase (v 7 ) near the centre of the machine. Increasing (v ) requires that the " f l u t t e r " of the magnetic f i e l d be increased. Un-^ m f o r t u n a t e l y , the centra l geometry of TRIUMF makes th is very d i f f i c u l t because the magnet gap is large and there are s i x s e c t o r s , making the spacing between the magnet sectors small at small r ad ius . One way of i n -creasing the f l u t t e r is to transform the f i e l d from a s i x - s e c t o r geometry to a three -sector geometry in the centra l reg ion . This is done by cu t t ing o f f a l te rnate magnet pole pieces at r = 40 i n . and adding to the remaining pole pieces steel wedges (see F i g . 1.2) extending to the centre of the c y c l o t r o n . This produces a f i e l d which is dominated by the th i rd harmonic rather than the s i x t h . This " th ree -sec tor geometry" produced a considerable improvement in (v.,) , as is shown by the dashed l ine in F i g . 3 .1 . With the m th ree -sec tor geometry, (v ) is greater than 0.1 for r > 10 i n . However, m the large th i rd harmonic caused undesirable e f f e c t s in the radia l o r b i t behaviour. There are two e f f e c t s caused by the three -sector geometry, an increase in phase o s c i l l a t i o n amplitude and the gap cross ing resonance. Which of these e f f e c t s , is most important depends on the o r i e n t a t i o n of the e l e c t r i c 56 f i e l d to the magnetic f i e l d . We def ine th is o r i e n t a t i o n by the angle <S shown in F i g . 4.1. The phase o s c i l l a t i o n e f f e c t r e s u l t s because, i f 6 =t= 0, the o r b i t covers 2 v a l l e y s and 1 h i l l on one h a l f - t u r n and 1 v a l l e y and 2 h i l l s on the next h a l f - t u r n . Hence, the lengths of the o r b i t on successive h a l f -turns are d i f f e r e n t , as can be seen in F i g . 4.7. If the n 1 * 1 harmonic dominates the v a r i a t i o n in the magnetic f i e l d , the o r b i t equation may be wr i t ten in the approximate form (e .g . Walkinshaw and K i n g 3 1 ) r = rr 1 + 1 B n 2 - l B -EL cosnO (4.15) where r Q is the radius of the ( c i r c u l a r ) o r b i t i f the f i e l d had no a z i -muthal v a r i a t i o n , B is the amplitude of the n*^ harmonic in the f i e l d and n r B is the average f i e l d . For the present case with n=3, r = r (1 + a cos38) o (4.16) 1 B 3 where a = ~. 8 B Now we wish to c a l c u l a t e the path length (s) between dee gaps. Using eqn.(4.16), we have ds_ de dr I dej 1 + a cos36 The approximation which has been made is that B g << 8 B. Hence, over one h a l f - t u r n we have 57 s i T o 6 = 6+TT (1 + a cos36)d6 = ^ + _ L i i s i n 3 6 (4.17) 12 B and over the fo l lowing h a l f - t u r n 8 = 6+27r s , r (1 + a cos36)d0 = T r - _ L i l s i n 3 6 (4.18) 12 B 6=S+TT So, between successive gap cross ings the phase o s c i l l a t e s by 5 x TZ\- sin3<5 I 2 B (since the RF operates on the f i f t h harmonic of the ion f requency) . The v a r i a t i o n of th is phase change as a funct ion of 6 is shown in F i g . 4.8 fo r a th i rd harmonic amplitude (B q) which w i l l produce v = 0.2. Phase h i s t o r i e s for a numerical o r b i t track corresponding to the worst case (6 = 30 deg) are shown in F i g . 4.9- The amplitude of the phase o s c i l l a t i o n is about 8.5 deg for the zero phase ion (for which the phase o s c i l l a t i o n would be zero without the th ree -sec tor magnetic f i e l d ) . This is in reasonable agreement with the theory. Since any phase o s c i l l a t i o n such as th is w i l l decrease the duty f a c t o r , 6 must be s m a l l , i . e . the c e n t r e l i n e of the dee gap should be c lose to the l ine running from a h i l l top at 6 = 0 to the opposite v a l l e y bottom at 6 = 180 deg. To keep the amplitude of the phase o s c i l l a t i o n less than 5 deg, we must have 6 < 16 deg. The e f f e c t of th is phase o s c i l l a t i o n is important here because the RF operates at the f i f t h harmonic of the ion frequency. It has been dismissed as unimportant for th ree -sector cyc lo t rons operat ing with N = 1 . 3 3 This phase o s c i l l a t i o n e f f e c t can be e l iminated by p lac ing the dee gap along a h i l l - v a l l e y c e n t r e l i n e (5 = 0 in F i g . 4.7). Unfor tunate ly , th is o r i e n t a t i o n maximizes another undesirable e f f e c t , the gap c ross ing 58 resonance. T h i s i s e s s e n t i a l l y a s h i f t i n the o r b i t c e n t r e p o i n t s a l o n g the dee gap caused by a l a r g e r m a g n e t ic f i e l d a t one dee gap than the o t h e r . T h i s e f f e c t has been d i s c u s s e d i n d e t a i l by Gordon, 3 3 but we can make an e s t i m a t e o f the e f f e c t s as f o l l o w s . R e f e r r i n g a g a i n t o F i g . 4.7, we can r e f e r t o the dee gap on the r i g h t s i d e by the s u b s c r i p t l and on the l e f t s i d e by the s u b s c r i p t 2; then the magnetic f i e l d s a t the gap a r e B. = B + Bo cos 6, (4.19) B2 = B - B3 cos 6 S i n c e t h e s e e f f e c t s are i m p o r t a n t a t low en e r g y , the r a d i u s o f c u r v a t u r e can be a p p r o x i m a t e d by If the i n c r e a s e i n energy at the dee gap i s AE MeV, the change i n r a d i u s o f c u r v a t u r e at the gap, assuming the ion s always c r o s s n o r m a l l y , i s Ap(E) = 56.92 B /E + AE -VE (4.20) The r a d i a l p o s i t i o n o f the ion does not change a p p r e c i a b l y as the gap i s c r o s s e d , so the change i n r a d i u s o f c u r v a t u r e i s r e f l e c t e d i n a change i n the p o s i t i o n o f the c e n t r e o f c u r v a t u r e . As the ion a l t e r n a t e l y c r o s s e s gaps 1 and 2, the c e n t r e o f c u r v a t u r e o s c i l l a t e s back and f o r t h a p p r o x i m a t e -l y a l o n g t he c e n t r e l i n e o f the dee. I f the ma g n e t i c f i e l d s a r e d i f f e r e n t a t the two gaps, t h e r e i s a net d r i f t o f the c e n t r e o f c u r v a t u r e towards the h i g h e r f i e l d , g i v e n by <5p = 56.92 I -i = l B . odd i /E i + l /E. k+1 ' I 1 i=2 - 2 even i vT7~ - /IT 1+1 1 (4.21) 59 where E i + l = E. + AE. ; i is the half-turn number and'AE. is the energy gained at the i th dee gap. Using eqn.(4.19) and the fact that B,/B << 1, this can be expressed as 6p - 56.92 1 = 11 I i+l _ B3 B cos .,(4.22) B The f i rs t term in the square bracket is the displacement of the orbit centre from the cyclotron centre. This term osc i l l a tes , hence its sum depends on the differences of the AE's. The second term in the square bracket is the centre point dr i f t due to the third harmonic component in the magnetic f i e l d . This term always has the same sign, hence wil l accumulate rapidly if B 3 is large. B 3 varies widely with radius (see Fig. 4.10); hence the sum depends on the magnetic f ie ld u|ed. Numerically summing the series for the values of B 3 shown in Fig. 4.10, and using AE. = 0.2 MeV at al l gaps, produced a centring error of 0.3 in. Numerical tracking of ions through the measured magnetic f ie ld using the computer code GOBLIN gave a centring error of about 0.5 in. for this f i e ld . Eqn.(4.22) shows that the centre point dr i f t due to B 3 is proportional to cos36 and hence could be eliminated to this approximation by choosing 6 = 30 deg. This means that the dee gap runs along a h i l l - va l l ey interface, but this is unfortunately the situation which produces the large phase osci l lat ions discussed above. The dr i f t in centre point could be reduced by putting a f i r s t harmonic in the magnetic f i e l d . The f i r s t harmonic causes the centre point to dr i f t and could be arranged to cancel out the dr i f t due to the gap crossing resonance, as has been described by Gordon 3 3 and van Kranenburg et ai.^ However, producing a f i r s t harmonic varying accurately enough with radius would be extremely d i f f i c u l t and necessitate special coi ls or shimming of 60 the magnet. In a d d i t i o n , the compensation is exact for only one RF phase. In summary, a l ign ing the dee gap along the cent re l ine of a h i l l (or va l ley ) produces a phase o s c i 1 l a t i o n of about 10 deg. A l ign ing the dee gap along a h i l l - v a l l e y in ter face exc i tes the gap-crossing•resonance causing a centr ing error of about 0 . 5 i n . , which can be only p a r t i a l l y cancel led by a f i r s t harmonic in the magnetic f i e l d . Or ientat ions between the two described above do not br ing the phase o s c i l l a t i o n and the centre point d r i f t within acceptable l i m i t s , and hence the three-sector magnetic f i e l d has not been adopted. D. Radial Centring The central region of a cyc lot ron must produce a beam which is centred at e x t r a c t i o n . By centred we mean that the o s c i l l a t i o n s of the o r b i t centre point approach the geometric centre of the machine as the energy increases . In TRIUMF the large energy gain per turn and low magnetic f i e l d produce large o s c i l l a t i o n s of the centre point at low energy. The centre point at in jec t ion must be o f f centre by about ha l f the radius gain per h a l f - t u r n (see, e . g . , Gordon 3 3) i f the o rb i t centre point is to approach the centre of the machine as the energy becomes large . This centre point displacement required because of the acce le ra t ion can be derived in a manner s i m i l a r to the der iva t ion of eqn.(4.22). If we assume c i r c u l a r o r b i t s , then the change in centre of curvature at one gap is x - x c i + l = P J " P : i + l and at the next gap - x = P i+i i+2* 61 Hence over one turn the change in centre point is * r . , ^ - x r : = - P i + 2 + 2 P i + 1 ~ P," (I»-23) If the energy gain per gap cross ing (AE) is << the energy E and the change in radius per gap cross ing (Ar) is << the radius r, we can approximate eqn.(4.23) by a d i f f e r e n t i a l equation d x r . = - A E (4.24) dE 2 d E 2 • Now i f the centre point (x .^) at i n f i n i t e energy is ze ro , i . e . the beam is centred, in tegrat ing eqn.(4.24) once y i e l d s X ' ( E ) - Al - d P . I i - _ A E 1 c v 2 dE 2 m Q c 2 P y 1 v * - o / where p and 6 are the usual r e l a t i v i s t i c factors and r^ is the cyc lot ron m c radius = (-410 i n . for TRIUMF). The r ight-hand s ide of eqn.(4.25) is just one-ha l f the radius gain per h a l f - t u r n at energy E. The above estimate provides a good s t a r t i n g point for f ind ing centra l o r b i t s , e s p e c i a l l y at high energy. However, at low energy where the geometry is complicated by the presence of the in jec t ion gap, we must resort to numerical o rb i t tracks to optimize the cen t r ing . The determination of what const i tu tes a centred o rb i t is complicated by several f a c t o r s . The azimuthal v a r i a t i o n of the magnetic f i e l d causes s c a l l o p i n g of the o r b i t ; hence the instantaneous centre point depends on the azimuthal angle. The average o r b i t radius and maximum s c a l l o p i n g are shown in F i g . 4.11 as a funct ion of energy. The quant i t i es we w i l l mainly be concerned with in th is sec t ion are r, 62 the radius of the ion from the geometric centre of the c y c l o t r o n , and p r , the radia l momentum. The momentum w i l l be wr i t ten in the form p = 8 y r^ . ( 4 . 2 6 ) In these u n i t s , the momentum of the ion is represented by i t s radius of curvature in the centra l magnetic f i e l d (B^). The radia l momentum is that component of the momentum which is d i rec ted in the radia l d i r e c t i o n , . i . e . dr r . P r = P 3 - ' = P - = P 5 i n x   ds v where tanx = ' n the centra l reg ion , the f l u t t e r in the magnetic f i e l d is s m a l l , hence the o r b i t s c a l l o p i n g is s m a l l , and we can roughly approx i -mate B by B and p by p; then the component of the centre point perpendicu-c 9 lar to the dee gap (y') equals p^ at 9 = 6 , i . e . the dee gap. The essent ia l features of the centra l o r b i t s of TRIUMF are shown in F i g . 4 . 1 2 . The magnetic f i e l d has s i x - f o l d symmetry. The cen t re l ine of the dee gap is 5 . 5 deg from the cen t re l ine of a v a l l e y . The azimuthal angle 9 is measured from the cen t re l ine of the dee gap as shown. One way to remove the compl icat ing e f fec ts of o r b i t s c a l l o p i n g , and to determine how c lose the o r b i t is to an ideal centred o r b i t , is to c a l c u l a t e , at some azimuthal angle, the d i f fe rence between the radius and radia l momentum of the actual accelerated o r b i t (a .o . ) and an e q u i l i b r i u m o r b i t (e .o. ) at the same energy. An e . o . is a f ixed energy o r b i t which c loses upon i t s e l f , has average centre of curvature at the centre of the machine, and is s tab le for small displacements in radius and momentum. The e . o . ' s are ca lcu la ted by the program CYCLOPS." Now for any energy at one azimuth, * CYCLOPS was k indly made ava i l ab le to TRIUMF by Dr. M. Gordon of Michigan State Un i vers i ty . 63 we know the radius and radial momentum Cr and p r ) of the equilibrium eo r ' e o orbi t . Hence, when tracking an a .o . , we can calculate the differences in radius and momentum between the e.o. and the a.o. at this azimuth. If an orbit is to be centred at the final energy, the differences between the e.o. and the a.o. during acceleration ( i .e . Ar = r - r and Ap = 3 ao eo ^r P r a o - P r e Q ) are due to centre poi at. dispiacements along the dee gap only (changes in x c) due to acceleration. Hence, as the energy increases and the changes in x c decrease, the values of Ar and Ap r (due only to a non-zero value of x c) wi l l decrease, and the a.o. wi l l approach the e.o. The locus of the point (Ar,Ap r) in phase space on successive turns (at one azimuth angle) as the acceleration proceeds forms an "accelerated phase plot". The gross features of the accelerated phase plot depend on the amount the instantaneous centre point of the a.o. , di f fers from the instan-taneous centre point of the e.o. (Ax^ and Ay c in the x- and y-direct ions, respectively) and on the azimuthal angle at which the accelerated phase plot is calculated. Suppose at some angle 9 q the a.o. has energy E, radius r g o and radial momentum p r . We interpolate in a table of equilibrium orbit radii and r ao radial momenta values for azimuth 9 to obtain r and p„ , which are the o eo reo radius and radial momentum of the equilibrium orbit at energy E. Now if we neglect the variation in the magnetic f ie ld along 9 between r and o eo r , then the radii of curvature are the same, i .e. p = p = p , and we ao' Keo ao K ' have the situation shown in Fig. 4.13- The angle x wi l l be small since p^ is much less than p and Ap^ wil l also be much less than p hence we can P are related to the differences in radius and radial momenta by approximate the arc p — b y a straight line and the centre point components 64 p A p r , P cos(6 - x) s i n (.9 - X') 0 0 (4.27) Ax c -sin(6 - x) cos (e - x) o o A r Thus the accelerated phase plot removes the "motions" in the o r b i t centre point due to s c a l l o p i n g of the o r b i t and allows the actual er rors in cent r ing to be determined. F i g . 4.14 shows A x c ca lcu la ted using eqn.(4.27) [using Ar and A p r values from a numerical track of a centred o rb i t ] compared to the values of A x c predicted by eqn.(4.25). | | is p lo t ted rather than x to allow comparison of the curves for 0 = 54.5°and 0 = 234.5°. The C 0 0 values of x £ are a l l negative for 0q = 54.5°and a l l p o s i t i v e for 9q =234.5°. The agreement is f a i r l y good; however, the only way to do the f i n a l o p t i m i -zat ion of the centr ing seems to be to work backwards from the centred o r b i t . That i s , we s t a r t an ion on a centred o r b i t at high energy and numer ica l ly -track i t backwards into the centre of the machine. If we do th is for several RF phases, we w i l l know what the s t a r t i n g condi t ions should be i f ions with var ious phases are to be cent red . Using a typ ica l magnetic f i e l d (01-03-06-70), ions with var ious s t a r t i n g phases weretracked backwards into the centre of the machine. The procedure which is used for t racking o r b i t s is as fo l lows . For energies less than 5 MeV the program PINWHEEL is used. This solves the r e l a t i v i s t i c equations of motion using measured magnetic f i e l d s and e l e c t r i c f i e l d s ca lcu la ted by the method descr ibed in Chapter 2. For energies greater than 5 MeV the program GOBLIN is used. This program solves the r e l a t i v i s t i c equations of motion using measured magnetic f i e l d s but approx i -mating the e f fec ts of the e l e c t r i c f i e l d s by the " impulse" approximation 65 described in Chapter 5. The t r a n s i t i o n is made at 5 MeV because above th is energy there is no s i g n i f i c a n t radia l v a r i a t i o n in the f i e l d across the dee gap, while for energies below 5 MeV there is such a v a r i a t i o n because of the tapering of the e l e c t r o d e s . The ions were s tar ted at 20 MeV at the c e n t r e l i n e of a v a l l e y (0 = -5.5 deg) , with A p r = 0 and with Ar equal to one-ha l f the turn separa-t ion per h a l f - t u r n , as indicated by eqn. (4.25). The accelerated phase p lots at 0 q = 54.5 deg and 9 o = -125.5 deg (see F i g . 4.12), i . e . at the c e n t r e l i n e of a v a l l e y , are shown in F i g s . 4.15, 4.16 and 4.17 for ions with s t a r t i n g phases of -30 deg, 0 and +30 deg, r e s p e c t i v e l y . For the ideal case where y is always zero and x becomes zero at high energy, then eqn.(4.27) shows that the A p r and Ar values w i l l always l i e on the s t r a i g h t l ine passing through Ar = 0 and Ap^ = 0 and at an angle of TT - 8 q to the Ar = 0 a x i s . This is the s t r a i g h t l i n e shown in F i g s . 4.15, 4.16 and 4.17. Using eqn. (4.27) and the data shown in F i g . 4.16, the values of x £ shown in F i g . 4.14 were c a l c u l a t e d . Ext rapola t ion of th is curve down to 0.4 MeV (the energy of the beam between the in jec t ion gap and the f i r s t main gap) indicates that the beam should be o f f centre by about 1.32 ± .05 i n . at th is energy. Since the radius of curvature of the beam is 11.88 i n . , th is means that the radius at which the f i r s t main gap should be crossed is 13.20 ± .05 i n . Accelerated phase p lots fo r three d i f f e r e n t choices of radius at the f i r s t main gap cross ing are shown in F i g . 4.18. The arrow on F i g . 4.18 gives twice the radia l o s c i l l a t i o n ampli tude. The curve for r = 13.20 i n . c l e a r l y leads to the smal lest amplitude radia l o s c i l l a t i o n . To determine what happens to other phases an ion was tracked backwards from r = 13-20 i n . at the f i r s t main gap through the in jec t ion gap, into the centre post , provid ing i n i t i a l condi t ions for outward t r a c k s . Using these 66 i n i t i a l c o n d i t i o n s , t r a j e c t o r i e s were fol lowed outwards for var ious phases, producing the phase p lot shown in F i g . 4.19. The -25 deg ion gives a radial osci 11 at ion amplitude of about 0.5 i n . , while the +25 deg ion gives an amplitude of about 0.8 i n . These o s c i l l a t i o n s are much too l a r g e , as they would lead to a very large energy spread at e x t r a c t i o n . In order to achieve more than a very narrow phase band, the s t a r t i n g condi t ions must be adjusted to favour ions which s t a r t with phases other than zero . Since the d i f f e r e n c e in the a c c e l e r a t i n g condi t ions which causes the large o s c i l l a t i o n amplitudes to develop is e s s e n t i a l l y the energy g a i n , which var ies roughly as cos cf), i t is reasonable to centre an ion whose phase corresponds to the average cosine in the phase band to be a c c e l e r a t e d . Since in the absence of th i rd harmonic in the RF we are r e s t r i c t e d e s s e n t i a l l y to p o s i t i v e phases, we w i l l choose s t a r t i n g condi t ions so that various p o s i t i v e phases are centred and observe how th is a f f e c t s the magni-tude of the radia l o s c i l l a t i o n s . F i g . 4.20 shows acce lera ted phase p lo ts for ions with the same phase range as in F i g . 4.19 but with s t a r t i n g c o n d i -t ions chosen to give centred o r b i t s for s t a r t i n g a phase of +17 deg. Phase p lots such as shown in F i g . 4.20 were ca lcu la ted using s t a r t i n g condi t ions to give centred o r b i t s for i n i t i a l phases of +15 deg, +17 deg, +19 deg and +21 deg. The resu l ts are summarized in F i g . 4.21. For a phase range of -5 deg to +25 deg, the amplitudes of the radia l o s c i l l a t i o n s are minimized i f an ion with i n i t i a l phase of 15 deg to 17 deg is cent red . If a small amplitude of o s c i l l a t i o n were desired (and a small phase width could be t o l e r a t e d ) , one would choose the case where the 0 deg ion was cent red . To f i r s t order the energy . reso-1 ut ion obta inable in . the extracted beam is related to the radia l osci 1 1 at ion ampl i-tude by the energy gain per turn . 67 For the case of TRIUMF, the maximum energy gain per turn (400 keV) produces a 0.064 i n . increase in radius at 500 MeV. When operat ing with a wide phase spread, the beam w i l l be spread out f a i r l y uniformly with r a d i u s , so that a ±0.064 i n . o s c i l l a t i o n w i l l worsen the energy reso lu t ion by ±400 keV (or a l t e r n a t i v e l y ±0.1 i n . w i l l produce ±600 keV) . Eqn.(4.25) shows that the x c required to allow for centre point motions due to acce le ra t ion is proport ional to AE and hence is a lso propor-t iona l to cosip s ince AE - qV Q cos<j>. There fore , i f the zero phase ion is centred at high energy and has centre point x ^ 1 at in jec t ion and x ^ 2 at some other energy, an ion with some other phase (<p) w i l l have a centr ing e r ro r (1 - cosd>)xc^l at i n j e c t i o n . If th is centr ing e r ror did not a l t e r the behaviour of the centre point motions with energy, we would expect th is i n i t i a l centr ing e r ror to produce a cent r ing e r ro r (1 - cosd>) ( x ^ 1 -at energy E 2 . The dashed l i n e in F i g . 4.21 shows th is centr ing e r ror as a funct ion of phase at i n j e c t i o n . F i g . 4.21 shows that the o s c i l l a t i o n amplitude is much larger than t h i s , so some mechanism is causing th is centr ing er ror to produce a large amplitude radia l o s c i l l a t i o n . One such mechanism is described in Sect ion E of th is chapter . Of course , the ion beam w i l l contain p a r t i c l e s with various d i s p l a c e -ments and divergences from the centra l ray, and we must invest igate how the beam as a whole is centred. This is d iscussed in the next s e c t i o n . In Sect ion H of Chapter 3 i t was shown that a f i e l d bump could be used to s h i f t the acceptable range of phases so that the accepted phase interval is centred about zero degrees. F i g . 4.22 shows the phase h i s t o r i e s for four ions in a f i e l d which has the bump descr ibed in F i g . 3-19 added to i t . As expected, the i n i t i a l phase interval of 0 deg to +50 deg is s h i f t e d to about -21 to +25 deg. The dashed l ine shows the t h e o r e t i c a l l y expected 68 phase s h i f t for the ideal bump. Note that the phase change is never fas te r than i d e a l , so no ions which are i n i t i a l l y focused are s h i f t e d to defocusing phases. Accelerated phase p lots for ions with var ious s t a r t i n g phases in the magnetic f i e l d with the bump added are shown in F i g . 4.23. The s t a r t i n g condi t ions are adjusted to favour the +17 deg ion (as in F i g . 4.20 without the f i e l d bump). The o s c i l l a t i o n amplitudes for phases of 0 deg, +15 deg and +30 deg are 0.13, 0.12 and 0.42 i n . , r e s p e c t i v e l y , while without the bump they are 0.20, 0.14 and 0.46 i n . Thus the e f f e c t of the bump is to s l i g h t l y decrease the o s c i l l a t i o n amplitudes in th is case. We would expect (from F i g . 4.21) that large p o s i t i v e phases would have very large o s c i l l a -t ion ampl i tudes, and th is is confirmed in F i g . 4.23, which shows that the ion that s ta r ts at +45 deg is unacceptable. This undesirable behaviour for large p o s i t i v e phases is not s i g n i f i c a n t l y improved i f we arrange the s t a r t -ing condi t ions to favour the +21 deg ion . Note that the rad ia l cent r ing requirement e f f e c t i v e l y sets a p o s i t i v e phase l im i t of about +25 deg , !so that the f i e l d bump used (designed for a phase interval of -5 deg to +45 deg, see Sect ion H of Chapter 3) is too large . However, the e f f e c t s of the bump on the radia l motion are s m a l l . E. E f fec ts of F i n i t e Beam Emittance Now we w i l l consider how the centr ing var ies over a beam with a r e a l i s t i c s i z e . The expected emittance of the TRIUMF ion source is 0.50 IT i n . mrad (at 300 keV). We w i l l assume that th is is not s i g n i f i c a n t l y increased by the transport system up to the point of i n jec t ion into the cyc lo t ron dees. To minimize the amplitude of the radia l o s c i l l a t i o n s we want to choose the i n i t i a l e l l i p s e shape to match the radia l f o c u s i n g , as descr ibed in Chapter 3 for ax ia l f o c u s i n g . Since the lens e f f e c t s of the 69 dee gaps are s m a l l , we f i r s t try matching to the magnetic f o c u s i n g , for which v r - 1.0 in the central region. To see how the emittance is t rans-formed as the beam is a c c e l e r a t e d , four p a r t i c l e s were t racked , s t a r t i n g on the edge of the emittance e l l i p s e . F i g s . 4."24(a)'', 4.25(a) and 4.26(a) show accelerated phase p lots for these four points for i n i t i a l phases of 0 deg, +15 deg and +25 deg, r e s p e c t i v e l y . As can be seen from these f i g u r e s , the e l l i p s e is "s t re tched" as the acce le ra t ion proceeds, produc-ing a large amplitude radia l o s c i l l a t i o n . This is due to an e f f e c t explained by M a c k e n z i e . 3 5 ' B r i e f l y , the e f f e c t is important in th is case because of the low f i e l d and large energy gain per turn causing the i n i t i a l o r b i t s to be fa r from the e q u i l i b r i u m o r b i t s . Consider the t r a j e c t o r i e s in phase space of two ions with i n i t i a l phases of +<j> and -<j>. An i n i t i a l displacement from the o r i g i n (Ar # 0 or A p r * 0) w i l l cause precession through an angle of approximately ( i f v r is c lose to 1) i r (v r - 1) during a h a l f - t u r n in the magnetic f i e l d . Since Ar * 0 or A p r 4= 0 means that the beam is not cent red , the ions a r r i ve at the next dee gap la te r or e a r l i e r than they l e f t the previous gap (as described in Sect ion B). Hence the energy gain is not the same for the +<p ion as for the -<j> one. This means that on the next h a l f - t u r n one ion w i l l be c l o s e r to i t s e . o . than the other to i t s e . o . , and while they both precess through the same ang le , the -<p ion w i l l precess so as to reduce i ts displacement from the o r i g i n in phase space, while the displacement of the +<p ion increases i f > 1. The e f fec t is reversed i f v r < 1. These displacements in phase space cause " s t r e t c h i n g " of the emittance e l l i p s e , producing a large amplitude radia l o s c i l l a t i o n . This e f f e c t is important when the ion energy is small and when v r is d i f f e r e n t from one, so that the precession is la rge . Numerical o r b i t tracks have shown that the e f fec t is unimportant above 10 MeV. 70 The amplitude of these o s c i l l a t i o n s can be reduced by choosing a d i f f e r e n t i n i t i a l e l l i p s e shape. If, for example, we choose an e l l i p s e which is reduced by a fac tor of two in the Ar d i r e c t i o n but increased by a fac tor of two in the Ap^ d i r e c t i o n from the e l l i p s e that is matched to v^ . = 1 , we obtain the phase p lots shown in F i g s . 4 .24(b) , 4.25(b) and 4.26(b) for the same three i n i t i a l phases as used p r e v i o u s l y . These phase p lots show that the o s c i l l a t i o n amplitude is reduced to 0.25 i n . over the phase range 0 deg to +25 deg. This represents an e f f e c t i v e increase by a fac tor of almost four in the o s c i l l a t i o n amplitude due to the phase-dependent a c c e l e r a t i o n . 71 CHAPTER 5. RADIAL LENS EFFECTS OF CYCLOTRON DEE GAPS A. Introduct ion The c a l c u l a t i o n of radia l motions in a cyc lo t ron at low energies re-quires a de ta i led knowledge of the e l e c t r i c f i e l d produced by the dees. The c a l c u l a t i o n or measurement of th is f i e l d is a d i f f i c u l t problem (see Chapter 2), and the numerical in tegrat ion of the equations of motion through the f i e l d is a slow procedure. To integrate the equations of motion from in jec t ion to ex t rac t ion would require a p r o h i b i t i v e l y large amount of com-puter t ime. It is therefore useful to have an approximate method of c a l c u -l a t i n g the radia l motions. One way of doing th is is to represent the rad ia l motion as h a l f - t u r n s in a purely magnetic f i e l d separated by a c c e l e r a t i n g impulses induced by the e l e c t r i c f i e l d s at the dee gap. The magnetic f i e l d is approximated by an isochronous f i e l d with v r (the rad ia l o s c i l l a t i o n frequency) constant over each h a l f - t u r n and determined by in te rpo la t ion in the values computed by the e q u i l i b r i u m o r b i t code for the real f i e l d . The e f f e c t s of the dee gaps are approximated by instantaneous changes in the energy (SE) , RF phase ( 6 t ) , radia l p o s i t i o n (Sx) and angle to the gap (S£) when the ion reaches the azimuthal angle of the centre l ine of the dee gap. Thus in a two-dee cyc lo t ron such as TRIUMF the ion w i l l pass through a 180 deg long magnetic f i e l d region (with v.^  cons tan t ) , then have i ts energy, rad ia l p o s i t i o n , RF phase and angle to the dee gap instantaneously changed as i t crosses the gap, then pass through another magnetic f i e l d region and dee gap, e t c . This chapter invest igates var ious approximations which give the quant i t i es descr ib ing the dee gap (SE, S t , Sx and 6 5 ) . The resu l ts from the approximations are compared to numerical o r b i t tracks through a real e l e c t r i c f i e l d . 72 Since we have v r constant over each h a l f - t u r n , we can approximate the radia l motion in the magnetic f i e l d by a s inuso ida l o s c i l l a t i o n about the equ i l ib r ium o r b i t . There w i l l a lso be a s i g n i f i c a n t o s c i l l a t i o n at the p r i n c i p a l f l u t t e r frequency, but th is w i l l produce no change over 180 deg in a s i x - s e c t o r machine. A P ; -We w i l l c a l l the amplitude of th is osci11 at ion Ar and the s l o p e - / P where p and p^ . are the total and radia l momenta, r e s p e c t i v e l y . The transformation of these quant i t i es are given by an equation equivalent to eqn . (3 -9 ) , i . e . Ar Ap . r P cos V s i n v —— s i n v 9 cos v 6 r r r Ar AP. (5.1) where r is the radius of curvature and 6 is the azimuthal angle in the magnetic f i e l d . Now we need a d e s c r i p t i o n of the changes in momentum and p o s i t i o n pro-duced by the dee gaps. F i g . 5.1 shows a typ ica l dee gap. The radia l motion of the ion is confined c lose to the median plane z = 0. F i g . 5-2 shows a p lo t of the instantaneous e l e c t r i c potent ia l in the median p lane . This f igure suggests that a f i r s t approximation to the e f f e c t s of the dee gap can be obtained by assuming that the gradient of the e l e c t r i c f i e l d is constant over some region and zero elsewhere. B. Constant Gradient Approximation with No Magnetic F i e l d We assume the gap is as shown in F i g . 5-3, uniform in the x - d i r e c t i o n , with a gap width of I and a tota l voltage across the gap of V . At time t = 0, the ion is at x = x , y = %I2 with v e l o c i t y x = x , y = y , . _ dx . _ dy X = d t ' y = d t The phase of the a c c e l e r a t i n g vol tage at t = 0 is <p and 73 i ts frequency is to. The equations of motion are x = 0 (5.2) y = % = k cos (cot + d>, ) m r o (5.3) where k = ^ £ , q and m being the charge and mass of the ion , r e s p e c t i v e l y . Integrat ing eqn.(5.2) gives x = x x = x + x t O 0 (5.4) (5.5) Integrat ing eqn.(5-3) gives y = y + — 0 10 s i n (tot + <t> ) - s i n (d> ) 0 0 y = y„ + y f + — cos (d>0) - cos (tot + tyQ) tsin(<()0) (5.6) (5.7) In p r a c t i c a l c a s e s , the e lectrodes which produce the f i e l d are located above and below the median p lane, and so the width of the f i e l d there is larger than the physical gap between the e lect rodes (as demonstrated in F i g . 5-1). We therefore t reat i as a f ree parameter to obtain the best agreement with numerical ly integrated o r b i t s . The time required for the ion to cross the gap x (the t r a n s i t time) is a lso as yet unknown. Within the v a l i d i t y of the approximation, the width of the e l e c t r i c f i e l d w i l l depend only on the geometry, while the t r a n s i t time w i l l depend on the e l e c t r i c f i e l d and the v e l o c i t y of the ion; hence we choose I so that the constant gradient approximation gives the same energy gain as the numerical resu l ts for one case , i . e . one incident energy and RF phase. Now, using th is value of £ , we c a l c u l a t e the t r a n s i t time T which is the value of T 74 that solves eqn. (5-7) when y - y = i . e . I + y T + -0 CO ( r cos(p0 - cos (COT + <p0) xsin(p0 = 0. (5.8) This can be solved by any standard numerical technique, for example the Newton-Raphson m e t h o d . 3 6 Once T is known, the changes in x , y , x and y across the gap can be c a l c u l a t e d . We w i l l c a l l the above approximation the i t e r a t i v e approximation, s ince i t requires an i t e r a t i v e so lu t ion of eqn.(5-8) to f i nd the t r a n s i t t ime. Now, wi thin the v a l i d i t y of the approximation, the value of £ found to be best in one case should a lso give the best resu l ts for other incident energies and phases. To se lec t an appropr iate value of I, the best method seems to be to compare the resu l ts of numerical in tegrat ions to the resu l ts predicted by the constant gradient approximation at high energy, where we expect the approximation to be most v a l i d . Since the i t e r a t i v e so lu t ion of eqn. (5.8) may be time consuming, one is tempted to look for simpler approximations. If the t r a n s i t time is small enough so that we can approximate sincot by cot and coscot by 1, then we obtain the "1 inear" approximation y = y + kt costp (5.9) O 0 y = y 0 + y 0 t (5.10) and the t r a n s i t time is x = ^ . (5.1D In th is case the assumption of small t r a n s i t time is equivalent to assuming that the v e l o c i t y of the ion is constant across the gap. A more exact approximation is obtained i f we keep terms up to (cot)2 in 75 the expansions of sincot and coscot; then we obtain the "quadrat ic" approxima-t ion which is Y = Y 0 + k and tcos<f>0 - | t 2 sincf>0 (5.12) y = y 0 + y 0 t + ^-t2 coscf>0. (5.13) The t r a n s i t time is obtained from eqn.(5-13) when y = - | - and is = "YQ - : > / y o Z + 2k £ c o s ^ k coscf> 0 (5.14) This approximation is equivalent to assuming that the ion v e l o c i t y across V the gap is the average of the in i ' t ia l and f ina l v e l o c i t i e s . A s t i l l bet ter approximation can be obtained by re ta in ing one more term in the expansion of sincot; then we obtain the " c u b i c " approximation y = y 0 + k , CO o • j C 0 ^ t J , tcosd>Q - - t z sin<J>0 cos<J)0 (5.15) The las t term in eqn . (5 .15) , wh i ch was neglected in e q n . ( 5 . l 2 v ) , is usua l ly as large as the second las t term in eqn. ( 5 -15 ) . In the cubic approximation we s t i l l c a l c u l a t e the t r a n s i t time using e q n . ( 5 . 1 4 ) . The v a l i d i t y of these approximations was tested by comparing the changes in x , k, y and y to those given by numerical in tegrat ion through a real e l e c t r i c f i e l d . The numerical c a l c u l a t i o n s solve the exact r e l a t i v i s t i c equations of motion. The var ious constant gradient approxima-t ions assume that the mass is constant across the gap; however, the mass used is the r e l a t i v i s t i c mass appropriate to the i n i t i a l ion energy. The e l e c t r i c f i e l d used was that for the gap shown in F i g . 5 - 1 , i . e . a tota l gap height of 4 .0 i n . and a tota l gap width of 6.0 i n . In the TRIUMF 76 cyc lo t ron the f i e l d produced by a gap of these dimensions is reached at a radius of 40 in . (about 5 MeV). The value of £ was se lec ted so that the i t e r a t i v e approximation gave the same energy gain as the numerical integra-t ion for (j> = 0 deg and E Q = 100 MeV. The value se lected was 8 . 9 7 i n . , considerably larger than the physical gap width of 6 . 0 i n . The gradient used for the approximation is shown by the dashed l ine in F i g . 5 - 2 . In th is case, there is no force in the x d i r e c t i o n ; hence p remains x constant and displacements in the x - d i r e c t i o n are just x t . The change in Py causes the energy of the ion to increase. We w i l l express the energy gain by the s o - c a l l e d gap factor G, G = — ~ — — x 100%, ( 5 . 1 6 ) qV Q cos<pc where AE is the actual energy gained by the ion and <p is the RF phase at which the ion crosses the centre of the gap. F i g . 5 - 4 compares the energy gain obtained by numerical o r b i t t racking in the real f i e l d for <f> = 0 deg with the energy gains predicted by the various constant gradient approximations. The small t r a n s i t time approx i -mations give very much less accurate resul ts than the-approximation based on exact computation of the t r a n s i t t ime, and hence they w i l l not be con-s idered fu r ther . Values of G for var ious phases and energies from the i t e r a t i v e constant -gradient approximation and from numerical in tegrat ion are given in Table V. Figure 5 - 5 shows the d i f fe rences between the values ca lcu la ted by numerical in tegrat ion and those from the i t e r a t i v e constant gradient approximation. In a l l cases , over a phase range of - 4 5 deg to +45 deg and an energy range'of 1 to 100 MeV, the d i f fe rences are less than 0 .5%. The errors displayed in F i g . 5 - 5 are inherent in the constant gradient TABLE V Gap fac tors given by numerical in tegra t ion and by the constant gradient approximation (no magnetic f i e l d ) Energy -45 -30 -15 0 + 15 +30 +45 ' (MeV) N IA ' N: IA N J'A N IA N IA N IA N 1A 1 78 .599 78 .319 78.921 78.840 79 .242 79.302 79 512 79 .683 79 .697 79 .963 79 .780 80.131 79.730 80 .177 2 88.718 88 .726 88.775 88.888 88 .847 89.034 88.905 89 .157 88.935 89 .249 88 .925 89.306 88.852 89 • 323 5 95 • 351 95 .349 95-318 95.381 95 304 95.412 95 291 95 .440 95 .272 95 .462 95 .241 95.478 95.183 95 .467 10 97 .663 97 .633 97-627 97.642 97 601 97.651 97 580 97 .660 97 .559 97 .668 97 .351 97.674 97.487 97 .680 20 98 .833 98 .790 98.802 98.791 98 780 98.794 98 762 98 .796 98 .743 98 .800 98 .720 98.803 98.687 98 .806 50 99 • 529 99.488 99.508 99.487 99 .493 99.487 99 479 99 .487 99 .466 99 .488 99 .449 99.490 99.426 99 .492 100 99 • 759 99 .722 99-742 99.720 99 730 99.720 99 719 99-.719 99 .709 99 .720 99.697 99.721 99.681 99 .723 N = IA = numerical resu l ts resu l ts from i t e r a t i v e approximation 78 approximation and not a resu l t of an inappropriate choice of £ , s ince chang-ing Jl merely d isp laces the family of e r ror curves. The other quant i ty of in terest is the t r a n s i t time. In a l l cases , the t r a n s i t time was wi th in 0.1% of the expected time of JcVv^ where v_ is the a a average of the i n i t i a l and f i n a l v e l o c i t i e s . Thus in th is case the e f f e c t of the gap can be approximated by ins tan-taneous changes at the centre l ine of the gap as f o l l o w s : 6E is the energy change appropriate to the v e l o c i t y change given by eqn.(5.6), 6t and 6x are zero and 6? is the change in angle due to the energy ga in . This change in angle resu l ts because p^ changes while p x remains constant and is. 6? = t a n " 1 Px Py + Ap tan" 1 Hx (5-17) where Ap is the increase in momentum given by eqn.(5-6), and p and p x y the i n i t i a l momentum components. are C. Sine Gradient Approximation To improve the resu l ts given by the constant gradient approximation, we should use an e l e c t r i c f i e l d which more c l o s e l y approximates the real f i e l d . F i g . 5.2 suggests that a better approximation than a l i n e a r l y vary-ing potent ia l (constant gradient) might be a potent ia l of the form = cos (tot + <j)o) cos (5.18) where L is a wavelength which descr ibes the e l e c t r i c f i e l d . If we def ine the average v e l o c i t y v = l i t (gap width % + L, see below), the equation 3 of motion i s , in so far as the actual v e l o c i t y can be approximated by the 79 average v e l o c i t y , y = krr cos (cot + <j> ) s i n ^ 3 — (5-19) Integrat ing eqn.(5.19) [assuming v is constant] gives 3 kit cos(p0 - COS tjui- + Tf,va/L) + (p0 to + T f V a / L (5.20) and cos (t(co - T f V a / L ) + <pQ] -•cos'j) ( CO + T T V _ / L y - y 0 = V + k,TT s i n<J>, S I n[t(c + T T V g / L ) + <p. ( C O + T T V a / L ) 2 (5.21) + t.:cos<p0 C 0 + T T . V a / L s in t(co - T r v a / L ) + <j>0 - sintp 0 t cos<p (co " T T V a / L ) co -rr v a / L It was found that the resu l ts were improved i f we allowed the gap width (£) to be less than the wavelength which descr ibes the e l e c t r i c f i e l d (L) . Thus we use only part of one cyc le of the sine funct ion to descr ibe the e l e c t r i c f i e l d grad ient . Of course , i f I < L, V q must be in-creased to cos JL(L A] L V.2 2) to maintain the same tota l voltage across the gap. Since v g and the time required to cross the gap are both unknown, we must solve eqn. (5.21) for the t r a n s i t time x when y - y = We' def ine v = %l\ so the t r a n s i t time is given by • 80 % + y 0 x + kit sincf>0 - s in (cot + nl/L + $Q) T COS(() 0 co + TT SL/LT (5.22) 2 (co + TT£/LT)"2 s in((ox - TT£/L + <j>0) - sinc()0 _ T cosc()0 0. + (co - -nl/Lr)2 co - TT£/LT This approximation was compared to the resu l ts of numerical in tegra-t ion through the real f i e l d as descr ibed above for the constant gradient approximation. Over a phase interval of -45 deg to +45 deg and an energy interval of 1 to 100 MeV, the er rors for the s ine gradient approximation were several times larger than for the constant gradient approximation; hence the s ine gradient approach was not pursued f u r t h e r . D. Constant Gradient Approximation with  Third Harmonic in the E l e c t r i c F i e l d Since i t is planned to " f l a t - t o p " the RF vol tage by adding a small f r a c t i o n of th i rd harmonic to the fundamental, i t is useful to der ive the constant gradient approximation for the case where the RF voltage is given by e is the f r a c t i o n of th i rd harmonic and 6 is the phase of the th i rd harmonic.with respect to the fundamental. The equation of motion in the y - d i r e c t i on is now y—= cos (cot + <j>0) - e cos(3cot + d>0 + <S) . (5.23) y = k cos (cot + ;<j>0) - E cos(3cot + tyQ + 6 ) (5.24) which when integrated gives y - y 0 = - s in (co t + <f>0) - sind) 0 - - sin(3cot + <f>0 + 6 ) - sin(<j>0 + 6 ) (5.25) 81 and y 0 = y 0 t + cos (cot + <p ) - cos<p - t sin<j>. (5 .26) 3w cos(3cot + <p0 + <5) - cos(cp0 + 6)j - t sin(d>0+ <5 The v a l i d i t y of eqns . ( 5 . 2 5 ) and (5-26) have not been checked by comparison with numerical i n t e g r a t i o n . However, i t is reasonable to expect them to be at least as accurate as (5 .6) and (5-7) when the RF voltage is not changing more rap id ly than i t does for the fundamental o n l y . For tunate ly , the phase region of in terest is p r e c i s e l y where the waveform given by (5-23) is f l a t , so that eqns . ( 5 . 2 5 )and (5-26) should be . o f as much u t i l i t y as (5 .6) and ( 5 . 7 ) . E. Constant Gradient Approximation with Magnetic F i e l d We now consider the case where the ion being accelerated sees a mag-ne t ic f i e l d B perpendicular to i ts plane of motion and an e l e c t r i c f i e l d with constant g rad ient . The equations of motion are and x = 3- B y m ' y = k cos (cot + <pQ) * B x m (5 .27) (5 .28) where as before k = q V 0 / m £ . If we assume that the magnetic f i e l d is isochronous, then the ion rota t ion frequency is constant and equal to qB/m. Integrating eqn . ( 5 . 2 7 ) once and using co = NqB/m (the RF f requency) , we obtain * " *0 = Sf(y " Yo) and y = k cos cot + <p (0 N S-Cy - y 0 ) (5 .29) (5 .30) 82 The so lu t ions to eqns. (5-29) and (5-30) a r e , for N+1, x = x„ - — k N 2 ' Y 0 + - T T ^ s . n ^ COS-C O t (5.31) + — CO k N ' j. Xr, —TT? COSCp0 W l 2 - ."tot s , n — k N + sin(cot'+ (p0) - sin<j>. x = k N 2 s i n-tot (5.32) k N ^t ^ k N / _ ^ , x c o s ¥ ~ + u " R t 2 c o s ( t o t + *o> ' Nx 0 N y = y 0 - — + -CO CO k N 2 . . y n + ry s i n<p, 0 co c s i n-tot (5.33) and k N X o " ^ H P C O S < f > o cot . k N' cos-n~ + N ' T N 2 y = • . k_ N 2 y ° co sin<p. cos-tot cos (cot + <pn) , (5.34) . cot s i n ¥ -k N 2 co 1-N Z sin(cot + <p0) The t r a n s i t time T is given by co k N 2 . , y o + ~T^ s m * o s i n-COT (5.35) k N u T^T2 c o s * 0 cos-_urr N + JZtf> cos (COT + <p0) Note that eqn. (5.35) takes into account the increase in path length due to the magnetic f i e l d . 83 Cohen, 3 C o m i t i 3 7 and R e i s e r 3 8 have derived equations s i m i l a r to eqns.(5-33) and (5-34), but they give no method for c a l c u l a t i n g the t r a n s i t time nor any ind ica t ion of the accuracy of the i r approximations. For the case without a magnetic f i e l d , displacements in the x - d i r e c t i o n depend on p x o n l y , s ince the e l e c t r i c f i e l d produces no component of force in the x - d i r e c t i o n . S i m i l a r l y , when a magnetic f i e l d is present the change in p x should be that due to the magnetic f i e l d o n l y , a s . i f the e l e c t r i c f i e l d were not present . That th is is true is v e r i f i e d by the work of C o m i t i 3 7 and by the resu l ts of numerical in tegrat ion in the present case. The energy gains predicted by eqn. (5.3*0 and those obtained from numerical in tegrat ion are given in Table VI. The value of I (the gap width) used was the one chosen for the zero magnetic f i e l d c a s e , i . e . 8.97 i n . The d i f fe rences in the gap fac tor G are shown in F i g . 5.6. The er rors in th is case are about ten times larger than for the case where no magnetic f i e l d was present . This is poss ib ly due to the fact that the curvature of the ion path causes the ion to spend more time near the edges of the f i e l d where the constant gradient approximation is least accurate . However, over the region of in terest (-30 deg < <j) < + 30 deg and E > 5 MeV) , the er rors are s t i l l less than \%. F i g . 5.7 shows the phase v a r i a t i o n of the e r ror in G. A more accurate d e s c r i p t i o n of the energy gain could be obtained by f i t t i n g some funct ion to the curves shown in F i g . 5.7 and using th is as a cor rec t ion to the energy gain predicted by eqn. (5.34). The e r rors in timing causes by assuming that the change in energy occurs d iscont inuously at the centre of the gap are about 1.5 deg (RF) at -45 deg and 1 MeV, 0.2 deg at 0 deg and 1 MeV, decreasing rap id ly with energy (<0.01 deg at 100 MeV). TABLE VI Gap factors given by numerica1 ' in tegra t ion and by the constant gradient approximation (iisochronous magnetic f i e l d ) Energy (MeV) -45 -30 -15 0 + 15 +30 +45 N IA N TA' N I'A N TA N JA N IA N TA 1 75 .487 78,126 77.009 78.654 78 .199 79 .124 79 .207 79.510 80.118 79.795 8.1.. 026 79.965 82.086 80 .013 2 86 .375 88.681 87-395 88.844 88 .166 88 • 991 88 .824 89.115 89.454 89.208 90.131 89.265 90.990 89 .284 5 93 .836 95.345 94.459 95.378 94 .919 95 .409 95 .318 95.437 95.709 95.459 96.151 95.475 96.745 95 .484 10 96 ••590 97.634 97.028 97.643 97 • 352 97 .652 97 .631 97.661 97.908 97.669 98.225 97.676 98.652 97 .681 20 98.080 98.791 98.390 98.793 98 .618 98 .795 98 .816 98.798 99.013 98.801 99.240 98.804 99.547 98 .807 50 99 .064 99.489 99.264 99.488 99 .411 99 .488 99 .539 99.489 99.667 99.489 99.814 99.491 100.014 99 .493 100 99 .429 99.722 99.577 99.721 99 .685 99 .720 99 .778 99.720 99.872 99.721 99.979 99.722 100.126 99 .724 N = numerical ly integrated resu l ts IA = resul ts from i t e r a t i v e approximation 85 In the present case (with a magnetic f i e l d ) , there is an apparent d i s -placement of the ion due to the change of radius of curvature . The numerical in tegrat ion of the ion o r b i t is done over a d istance d in the y - d i r e c t i o n . If the radius of curvature before the gap is pi, and a f t e r the gap i s . p 2 , the displacement we would expect from y = y to y =- i f the change in radius of curvature occurs d iscont inuous1y at the centre of the gap with no displacement along the gap, is Ax = cos s i n _ 1 ( d / 2 . p 9 ) " ( P 2 - P l ^ " P i cos s i n "1 ( d / 2 p . ) 8 P l P 2 (5.36) In F i g . 5.8 the values of Ax found from eqn. (5.36) are compared with the numerical ly tracked o r b i t s . The agreement is e x c e l l e n t . This means that 6x, the displacement of "the o r b i t at t h e d e e g a p , - i s e f f e c t i v e l y ze ro , and the energy gain resu l ts in a displacement of the centre of curvature . Thus, in th is case as in the case where no magnetic f i e l d was present , we approximate the e f f e c t of the gap by instantaneous changes at the centre l i n e of the gap as fo l lows: SE is the energy change corresponding to the v e l o c i t y change given by eqn. ( 5 . 3 * 0 , 6t and 6x are given zero v a l u e s , and 65 is the "col 1 imation" given by eqn. (5 -17) -F. Constant Gradient Approximation with Magnetic F i e l d  and Thi rd Harmonic in the E l e c t r i c F i e l d Using the RF voltage given by eqn. (5.23) and inc luding the e f f e c t s of an isochronous magnetic f i e l d , the equations of motion are y'b> ( 5- 3 7 ) and 86 (5 .38) •• . CO^ , CO y + — y + — N 2 N = k cos (cot + <j>0) - e cos(3cot + <f>0 + S) For N 4= 1 , the so lu t ions to eqns. (5 .37) and (5 .38) are r s ind>0 _ 3 e x = y 0 + — N 2 0 CO I V-H2- 1-9N Z • " , , X Y o -2 sin((p 0 + 6) costp 1-N2 1 - 9 N 2 cos (<p0 + 6) s i n cos cot_ N J r ^ cot (5 .39) + ^ " P N 2 C ° s ( w t + *o ) x - x Q = - _ CO + _ Yo + x o " N 2 s i n<f>c l l - N 2 ek N co 1 -9N 2 3e cos (3cot + <p + 6) , 1-9N 2 sin((p 0 + 6) cot COS IN J l l - N 2 1-9N - cos (<pQ + 6) cot s i n I N J (5.40) _L kN co2 1 - N 2 sin(cot + <j> ) - sin<p 1 ekN 3co2 1 -9N 2 sin(3cot + <f>0 + 6) - sin(tp 0 + 6) Yo + - N 2 x 0 - _ N CO sin<f>0 3e I 1 - N Z 1-9N 2 coscp. l l - N 2 1 -9N 2 sin(<p0 + 6) cos (<p0 + 6) cos cot J IN J s i n cot l.N (5.41) k N 2 ^pk N 2 - -n^ s i n ( w t + * o ) + T " T ^ s i n ( 3 w t + * o + 6>> y - Yo = -NXp_ + N CO CO Yo + N2 s ' ncf)0 l l - N 2 3 e sin(<j>0 + 6) 1 - 9 N 2 cot s in IN J (5.42) 87 xo " cosrJ>f U - N 2 1-9N2 Ek N2 cos ((J>0 + 6) M J cos IN J -9N2 cos(3cot + d)0 + 6) These equations have not been compared to the resu l ts of numerical i n t e g r a t i o n s , but the d i f f e rences should be comparable to those quoted in the previous sect ion over the region of i n t e r e s t . 88 CHAPTER 6. SUMMARY AND CONCLUSIONS The motion of the ions at the centre of a cyc lo t ron has been studied with p a r t i c u l a r reference to the TRIUMF c y c l o t r o n . 6 The object was to invest igate the factors determining the phase acceptance and beam q u a l i t y of the c y c l o t r o n , and to consider how the design might be adjusted to optimize these q u a n t i t i e s . The c a l c u l a t i o n of both ax ia l and radia l motion requires knowledge of the e l e c t r i c and magnetic f i e l d s . The magnetic f i e l d s used were measured on model magnets. The e l e c t r i c f i e l d s were ca lcu la ted by numerical ly so lv ing Lap lace 's equation using the re laxat ion method. The convergence and accuracy of th is method was invest igated in d e t a i l . Numerically s o l v -ing a problem for which the so lu t ion could be found a n a l y t i c a l l y showed that the numerical so lu t ion contained average er rors less than 0.011. The method uses a novel feature to obtain accurate s t a r t i n g values for the i t e r a t i o n , and the so lu t ion time for a very large problem (2 x 10 6 data points) is about 3 hours on an IBM 360/67. The ax ia l motions were studied using the th ick lens d e s c r i p t i o n of the dee gaps developed by R o s e , 1 Cohen 3 and R e i s e r . 2 2 A method was developed for c a l c u l a t i n g the axia l acceptance of the acce le ra to r as a funct ion of RF phase. It was found that the ax ia l acceptance exh ib i t s a sharp c u t - o f f at about -5 deg, i . e . ions with phases more negative than -•5 deg cannot be acce le ra ted . This e f fec t resu l ts because, for negative phases, the f i e l d is r i s i n g , and the f i e l d v a r i a t i o n e f f e c t causes the dee gaps to defocus the ions. This e f f e c t is more important for TRIUMF than for other cyc lo t rons because the RF operates at the f i f t h harmonic of the ion frequency, causing the e l e c t r i c forces to be much s t ronger . The negative phase l im i t can be sh i f t ed to more negative values by f l a t - t o p p i n g 8 9 the RF waveform. This f l a t - t o p p i n g can be produced by adding some th i rd harmonic of the RF frequency to the fundamental waveform. It is shown that addi t ion of 12% of t h i r d harmonic in phase with the fundamental s h i f t s the c u t - o f f due to the f i e l d v a r i a t i o n e f f e c t to about -15 deg. This s i t u a t i o n can be fur ther improved by adding 15% of t h i r d harmonic sh i f t ed 10 deg from the fundamental. For th is case the negative phase l im i t is s h i f t e d to about -25 deg. The e f f e c t of f i e l d bumps is inves t iga ted . For the case of TRIUMF a r a d i a l l y decreasing f i e l d bump at the cyc lo t ron centre cannot produce enough ax ia l focusing to overcome the strong e l e c t r i c f o r c e s . However, a c a r e f u l l y designed f i e l d bump can be used to s h i f t the phases of the ions. It is shown how to design a f i e l d bump to s h i f t those phases i n i t i a l l y favoured by e l e c t r i c focusing (pos i t ive phases) into phase with the peak of the RF voltage when e l e c t r i c focusing is less important. This is done without s h i f t i n g the ions to phases where they are defocused by the e l e c t r i c f i e l d . The radia l motions of the ions in the f i r s t turn were studied to f ind the best p o s i t i o n of the in jec t ion gap. A pos i t ion c lose to 36 deg back along the o r b i t from the main gap was found to provide the best centr ing and phase h i s t o r i e s . To al low economical o r b i t t racking out to high energ ies , an a n a l y t i c d e s c r i p t i o n of the changes in radia l o r b i t proper t ies on cross ing a dee gap was developed. The resu l ts of th is approximation d i f f e r from the exact changes (found by numerical in tegrat ion) by less than 1% for energies above 5 MeV. The beam centr ing was studied by t rack ing ions through r e a l i s t i c e l e c t r i c and magnetic f i e l d s (to 5 MeV), then to 20 MeV by in tegrat ing 90 through the magnetic f i e l d and using the approximation mentioned above. The resu l ts of these o r b i t tracks showed that the transformation of the rad ia l beam e l l i p s e is qui te phase dependent. This may be reduced by reducing phase-dependent e f f e c t s at the dee gaps. The energy reso lu t ion of the beam is invest igated by t rack ing ions to 20 MeV. The radia l o s c i l l a t i o n s present at 20 MeV are reduced by a fac tor of about 1.5 during acce le ra t ion to 500 MeV due to ad iaba t ic compression. The f i n i t e emittance of the beam a lso worsens the energy reso lu t ion by ±300 keV. If the ion with i n i t i a l RF phase of 0 deg is centred large rad ia l o s c i l l a t i o n s develop for ions with other i n i t i a l RF phases. For example, i f we require an energy reso lu t ion of ±600 keV, then ha l f of th is can be allowed to the coherent radia l o s c i l l a t i o n s , meaning that . the o s c i l l a t i o n amplitude allowed is 0.05 i n . at 500 MeV or 0.07 i n . at 20 MeV. This allows a phase acceptance of 16 deg. For an energy reso lu t ion of ±1200 keV the phase acceptance is 26 deg. For the case where large duty cyc le is requ i red , the largest phase acceptance is obtained i f an ion in the centre of the phase in terva l is centred (rather than the ion with 0 deg i n i t i a l phase) . For ±1200 keV energy r e s o l u t i o n , for example, the phase acceptance can be increased to -17 deg to +26 deg by centr ing the ion with i n i t i a l phase of 17 deg. In summary, the ax ia l motions place a p o s i t i v e l i m i t >60 deg on the phase acceptance. The negative l im i t is -5 deg without th i rd harmonic, -15 deg with 12% of t h i r d harmonic in phase with the fundamental, and -25 deg with 15% of t h i r d harmonic s h i f t e d by 10 deg from the fundamental. The radia l motions allow a phase acceptance of -8 deg to +6 deg for an energy reso lu t ion of ±600 keV or -17 deg to +26 deg for an energy resolution of ±1200 keV, in both cases with RF fundamental o n l y . 91 REFERENCES .1. M.E. Rose, "Focusing and Maximum Energy of Ions in the C y c l o t r o n " , Phys. Rev. (Ser. II) 53., 392 (1938) 2. D. Bohm and L . L . Fo ldy , "Theory of the Synchro -Cyc lo t ron" , Phys. Rev. (Ser. II) 72, 649 (1947) 3. B .L . Cohen, "The Theory of the Fixed Frequency C y c l o t r o n " , Rev. S c i . Instr . 24, 589 (1953) 4. M. Re ise r , " I n i t i a l Acce le ra t ion and Radial Focusing in the Non-uniform E l e c t r i c F i e l d at the Ion Source of the C y c l o t r o n " , Michigan State Un ivers i ty Cyclotron P r o j e c t , Report MSUCP-16 (1963) 5. W.B. Powell and B .L . Reece, " In jec t ion of Ions into a Cyclot ron from an External Source" , Nucl . Instr . Meth. 32_, 325 (1965) 6. E.W. Vogt and J . J . Burgerjon, e d i t o r s , "TRIUMF Proposal and Cost Estimate" (1966) 7. G.M. St inson et al. , " E l e c t r i c D i s s o c i a t i o n of H~ Ions by Magnetic F i e l d s " , TRI-69-1 (1969) 8. T . E . Zinneman, "Three-dimensional E l e c t r o l y t i c Tank Measurements and V e r t i c a l Motion Studies in the Central Region of a C y c l o t r o n " , Un ive rs i t y of Maryland, Department of Physics and Astronomy, Technical Report No. 986 (1969) 9. D. V i t k o v i t c h , Field Analysis (D. van Nostrand, London, 1966) , 205 10. V . P . Pronin and A . N . Safonov, "Measurement of the E l e c t r i c a l F i e l d in the Central Region of the Dubna Synchrocyclotron by the Induced Current Method", Communications of the Jo in t Inst i tu te for Nuclear Research, Dubna, No. JINR-P9-4851 (1969) 11. J . M . van Nieuwland, H.L. Hagedoorn, N. Hazewindus and P. Kramer, "Magnetic Analogue of E l e c t r i c F i e l d Conf igurat ions Appl ied to the Central Region of an AVF C y c l o t r o n " , Rev. S c i . Instr . 39_, 1054-5 (1968) 12. G . E . Forsythe and W.R. Wasow, 'Finite-Biffevenoe Methods for Partial Differential Equations ( J . Wi ley , New York, i960) 13- D. Nelson, H. Kim and M. R e i s e r , "Computer Solut ions for Three-Dimensional Electromagnetic F i e l d Geometries", IEEE Trans. Nucl . S c i . NS-16, 766 (1969) 14. D. Nelson, "The Relaxation Code - Solut ions of Lap lace 's Equation for Non-Analy t ica l Three-Dimensiona1 Geometries", Un ivers i ty of Maryland, Department of Physics and Astronomy, Technical Report No. 960 (1969) 15. D.W. Peaceman and H.H. Rachford, J r . , !'The Numer ica l 'So lut ion of Pa rabo l i c and E l l i p t i c D i f f e r e n t i a l Equat ions" , J . Soc. Ind. A p p l . Math. 3, 28 (1955) 92 16. D. Young, "The Numerical Solut ion of E l l i p t i c and Parabo l ic P a r t i a l D i f f e r e n t i a l Equations" in Modern Mathematics for the Engineer: Second Series, ed . E. Bedanbach (McGraw-Hi l l , New York, I96I) , 373-419 17. C. Han, p r iva te communicat i o n , . J u l y 25, 1969 18. J . R . Richardson, "Sector -Focus ing Cyc lo t rons" in Progress in Nuclear Techniques & Instrumentation,. Vol.1, ed . F.M. Far ley (Nor th -Ho l land , ' Amsterdam, 1965) , 3~101 19r M. R e i s e r , "Space charge e f f e c t s and current l im i ta t ions in c y c l o t r o n s " , IEEE Trans . Nuc l . S c i . NS-13, 171 (1966) 20. F. K o t t l e r , "E1ektrostat ik der L e i t e r " in Handbuch der Physik, V o l . 12, ed. W. Westphal (J . Spr inger , B e r l i n , 1927), 466-85 21. R.L. Murray and L.R. Ratner, " E l e c t r i c F ie lds wi th in Cyclotron Dees", J . App l . Phys. 24, 67 (1953) 22. M. R e i s e r , " F i r s t - O r d e r Theory of E l e c t r i c a l Focusing in C y c l o t r o n -Type Two-Dimensional Lenses with S t a t i c and Time-Varying P o t e n t i a l " , Un ive rs i t y of Maryland, Department of Physics and Astronomy, Technical Report No. 70-125 (1970) 23. C Han, "Computer Results for the Focal Propert ies of Two- and Three-Dimensional E l e c t r i c Lenses with Time-Varying F i e l d s " , Un ivers i ty of Maryland, Department of Physics and Astronomy, Technical Report No. 70-126 (1970) 24. S. Penner, " C a l c u l a t i o n s of Propert ies of Magnetic De f lec t ion Systems", Rev. Sci . Instr . 32_, 150 (1961) 25. K.G. S t e f f e n , High Energy Beam Optics ( In te rsc ience , New York, 1965) 26. A . P . Banford, The Transport of Charged Particle Beams (E. Spon, London, 1965) 27. K .L . Erdman e.t. al. , "A 'Square-Wave' RF System Design for the TRIUMF Cyc lo t ron" in Proceedings, International Cyclotron Conference, 5th, Oxford , 1969 (Butterworths, London, to be published) 28. L. Smith and A . A . Garren, "Diagnosis and Correct ion of Beam Behaviour in an Isochronous C y c l o t r o n " , Proc. Internat ional Conference on Sector -focused Cyclotrons & Meson F a c t o r i e s , Geneva, 1963 (CERN, Geneva 1963) 29. L. Root and E.W. Blackmore, pr iva te communication (1970) 30. M. Reiser and J . Kopf, " E l e c t r o l y t i c Tank F a c i l i t y and Computer Program for Central Region Studies for the MSU C y c l o t r o n " , Michigan State Un ive rs i t y Cyclotron P r o j e c t , Report No. MSUCP-19 (1964) 31. W. Walkinshaw and N.M. K ing , "L inear Dynamics in Spi ra l Ridge Cyclot ron Des ign" , Atomic Energy Research Establ ishment , Harwel l , England, Report No. AERE-GP/R-2050 (1956) 93 32. l i .K . Craddock and J . R . R i cha rdson , "Magnet ic F i e l d To lerances f o r a S i x - S e c t o r 500 MeV H" C y c l o t r o n " , TRIUMF Report TRI-67-2 (1968) 33- M.M. Gordon, "The E l e c t r i c Gap-c ross ing Resonance in a Th ree -sec to r C y c l o t r o n " in Proceed ings j I n te rna t i ona l Conference on Sec to r - f ocused C y c l o t r o n s , Los Ange les , 1962, (No r th -Ho l l and , Amsterdam, 1962), 268-80 34. A . A . van Kranenburg, H.L. Hagedoorn, P. Kramer and D. W i e r t s , "Beam P r o p e r t i e s of P h i l i p s ' AVF C y c l o t r o n s " , IEEE Trans . N u c l . S c i . , NS-13, 41-7 (1966) 35- G.H. Mackenz ie , " O r b i t Dynamic C a l c u l a t i o n s f o r TRIUMF", to be pub l i shed (IEEE Trans . N u c l . S c i . , NS-18, 1971) 36. C E . F robe rg , Introduction to Numerical Analysis (Addison-Wesley, Read ing, M a s s . , 1965) 37- S. Comit i and R. G i a n n i n i , "Etude de l a geometr ie c e n t r a l e du synchro-c y c l o t r o n avec source ' c a l u t r o n ' " a e x t r a c t ion haute f r equence " , CERN Report No. 70-9 (1970) 38. M. R e i s e r , " C e n t r a l O rb i t Program. fo r a V a r i a b l e Energy M u l t i - P a r t i c l e C y c l o t r o n " , N u c l . I ns t r . S Meth. J_8,J_9_, 370 (1962) 39- S . P . Frankel , "Convergence Rates of I t e r a t i v e Treatments of P a r t i a l D i f f e r e n t i a l E q u a t i o n s " , Math. Comput. 4_, 65 (1950) h O . D. Young, " I t e r a t i v e Methods f o r S o l v i n g P a r t i a l D i f f e rence Equat ions of E l l i p t i c Type " , T rans . Amer. Math. Soc. ]S_t 92 (1954) 41 . R. Courant , " P a r t i e l l e D i f fe renzeng le ichungen und D i f f e r e n t i a 1g1eichun-g e n " , in A t t i , I n te rna t i ona l Congress of Mathemat ic ians (New S e r i e s ) , 3 r d , Bo logna, 1928 (Bologna, N. Z a n i c h e l l i , 1929) F i g . 1 . 1 Central region pf the TRIUMF cyclotron - median plane ; F i g . 1.2 Central region of the TRIUMF cyc lo t ron - sec t ion through cen t re l ine of h i l l #3 96 F i g . 2.1 Relaxation Mesh Organization. Total number of nodes i s (p+1)(q+1)(r+1 ) . i 1—i—i—i—r~T~i 1 1 1 — i — i — i i i | —i 1 1 — i — i— r 1 error 1 change per iteration x Error bars indicate error at v which number of points has fal len N . h 1 >r- ^ 1 N \ to half the peak value. -^X ? a - 1 . 5 \ \ -X 1 XH —i sx \ \ \ \ 1 X N \ \ J I I I I I I I I I I I I I I I I I I ' I I I 0.05 0,1 0.5 1.0 5.0 average error [or change/iteration] (%) Fig. 2.2 Average error and average change per iteration vs number of sweeps over large volume number of nodes with e r ror indicated o o o ro oi ^ 66 1 0 0 -o o 5 0 1 0 0 IO3 IO4 number of nodes with er ror indicated F i g . 2.5 Number of nodes with a given er ror vs number of sweeps over large volume for various s i z e e r rors f i e l d 1-30-06-70 (six sector) E (MeV) F i g . 3.1 Magnetic ax ia l focusing frequency (v 2) vs energy for three- and s i x - s e c t o r magnetic geometries F i g . 3 . 2 Equivalent ax ia l focusing frequency produced by space charge forces vs energy for various beam currents and axia l beam heights z Fig.3.3 Cross-section of dees near accelerating region showing e l e c t r i c equipotentials and (schematically) an ion trajectory 104 F i g . 3-4 Comparison between equivalent e l e c t r i c ax ia l focusing frequencies predicted by the th in lens approximation and determined by numerical in tegra t ion F i g . 3-5 P o s s i b l e TRIUMF c e n t r a l geometry w i t h t h r e e a c c e l e r a t i n g gaps i n the f i r s t h a l f - t u r n F i g . 3-6 Axial emittance e l l i pses required at inject ion for various RF phases F i g . 3.7 Axial acceptance vs RF phase for var ious in jec t ion energies (one acce le ra t ing gap in the f i r s t h a l f - t u r n ) RF phase (d>) degrees F i g . 3.8 A x i a l acceptance vs RF phase for various i n j e c t i o n energies (three a c c e l e r a t i n g gaps in the f i r s t h a l f - t u r n ) Fig. 3-9 Average axial acceptance (averaged from -30 deg to +60 deg) vs injection energy (one accelerating gap in the f i rs t half-turn) _ J I I _ J I I I I L - 2 0 - 1 0 0 10 2 0 3 0 4 0 5 0 61 RF phase (ty) degrees F i g . 3.10 A x i a l a c c e p t a n c e vs RF phase f o r v a r i o u s c h o i c e s o f the i n i t i a l e m i t t a n c e e l l i p s e T 1 1 1 1 1 1—; 1 r -80 - 4 0 0 40 80 RF phase (<p) degrees F i g . 3-11 RF voltage waveforms with various amounts of th i rd harmonic and phase s h i f t between fundamental and th i rd harmonic RF phase (<j>) degrees Fig. 3.12 Slope of RF voltage waveform with various amounts of third harmonic and phase shift between fundamental and third harmonic F i g . 3-13 A x i a l a c c e p t a n c e vs RF phase f o r v a r i o u s c h o i c e s o f the i n i t i a l e m i t t a n c e e l l i p s e , e = 0.17, 6 = 0 F i g . 3.14 A x i a l a c c e p t a n c e vs RF phase f o r v a r i o u s c h o i c e s o f the i n i t i a l e m i t t a n c e e l l i p s e , e = 0 . 1 2 , 6 = 0 l I 1 1 1— 1 r RF phase (<f>) degrees F i g . 3-15 Axial acceptance vs RF phase for var ious choices of the i n i t i a l emittance e l l i p s e , e = 0.15, <$ = -10 deg 0.08h 0.04 CM N CM N 0.0 -0.04h -0.08 Energy (MeV) Total (Magnetic and e l e c t r i c ) equivalent ax ia l focusing frequency vs energy for various RF phases IQ ro Ol T t r a n s i t i o n phase (degrees) i i -I -I O 0) 3 ^ in D — (B rt ua _ . CU O rt 3 m — - 3 < T J CO n> z r —\ 0) CQ t-t in -< o co ~u •—-o o CO in - h <= — • rt rt — o < rt CD 0) — - — • < 01 m X fD 01 3 — CO - l - h CQ O •< O c in CO £11 F i g . 3.18 Change in sine of RF phase required to keep ion at t r a n s i t i o n phase vs radius 1 0 -in in 3 m 0 required to keep ions at t r a n s i t i o n phase - a c t u a l l y used (approx.) 32 radius ( in . ) U3 F i g . 3-19 Magnetic f i e l d bump required to keep ion at t r a n s i t i o n phase vs radius 120 F i g . 4.1 Geometry of i n j e c t i o n gap and f i r s t main gap for two RF phases 121 0.24 0.12 \ x - \ 1 \ 1 1 • *— / 1 m , — i i \ / I 1 •> 1 1 1 • • • "^ "^  • . 1 1 | | 9 / • • • . • o -0.12 Fig. k.2 y vs RF phase at injection gap for various injection gap positions ' <D (degrees) Fig. 4.3 Energy gain in injection gap and first main gap vs RF phase at injection gap for various injection gap positions 122 F i g . k.k RF phase at f i r s t main gap vs RF phase at i n j e c t i o n gap for var ious i n j e c t i o n gap pos i t ions 124 hal f - turn number F i g . 4.6 RF phase vs ha l f - turn number for various i n i t i a l phases with no f lu t te r in the magnetic f i e l d 125 hi 11 / val1ey . Fig. 4.7 Geometry of an orbit in a three-sector magnetic field 126 6 (degrees) F i g . 4.8 RF ph ase d i f f e rence on succeeding h a l f - t u r n s as a funct ion of o r i e n t a t i o n of the dee gap (6) Fig. h.3 RF phase vs half-turn number for various initial phases with a three-sector magnetic field (6 = 30 deg) T f i e l d 1-14-05-70 rad i us ( in . ) F i g . 4.10 Ratio of th i rd harmonic amplitude in magnetic f i e l d to average f i e l d vs radius for ( three-sector) f i e l d 1-14-5-70 F i g . 4.11 Average o r b i t radius and maximum o r b i t s c a l l o p i n g vs radius for (s ix -sector ) f i e l d 1-30-06-70 130 F i g . 4.12 Geometry of an o r b i t in a s i x - s e c t o r magnetic f i e l d F i g . 4.13 Geometry of the d i f fe rence between an equ i l ib r ium o r b i t and an accelerated o rb i t 132 0 0.5 I i /. \ 1.0 1.5 Ix c I ( in . ) F i g . k.]k Centre-point displacement along the dee gap vs energy showing values from numerical o r b i t tracks and from an a n a l y t i c approximation 0.8 0.6 0.4 -1 1 \ 1 •0.65 MeV \ 1 1 1 * = -30° e 0 = 54.5° e 0 = 234.5° -\ o 0.80 MeV \ ' N \ \ \ \ \ ^ \ <i> \ / \ / \ \ ' \ \ o \ \ * \ \ v V \ O \ \ o \ \ ' \ \ o \ \ 1 _ \ \ ' \ \ o \ \ b -1 1 1 \ \ x \ \ b \ \ \ \ \ \ \ V \ x \ <\ \ * 5.08 MeV \5.23 MeV l 1 1 \ -0.8 -0.6 , x -0.4 -0.2 Ar (in.) Fig. 4.15 Accelerated phase plot inwards from 5 MeV, d> = -30 deg F i g . 4.16 Accelerated phase plot inwards from 5 MeV, <p = 0 deg Fig. 4.18 Accelerated phase plot outwards for various radii at first main dee gap, d> = 0 deg 137 F i g . 4.19 Accelerated phase p lot outwards from i n f l e c t o r ex i t for var ious phases; ion with <p = 0 is centred 138 F i g . 4.20 Accelerated phase p lot outwards from i n f l e c t o r ex i t for var ious phases; ion with <J> = +17 deg is centred -25 -20 -15 -10 -5 0 5 10 15 20 25 30 RF phase (ty) (degrees) F i g . 4.21 Betatron o s c i l l a t i o n amplitude vs RF phase for var ious s t a r t i n g condi t ions 140 F i g . 4.22 Phase h i s t o r i e s of ions with var ious s t a r t i n g phases in a magnetic f i e l d with a f i e l d bump F i g . 4.23 Accelerated phase p lo t outwards from i n f l e c t o r ex i t for var ious phases using the magnetic f i e l d with the f i e l d bump; ion with cf> = 17 deg is centred F i g . h .2h Accelerated phase p lots with <p = 0 deg for four points on the edge of the emittance e l l i p s e a) matched to v r = 1, and b) chosen to reduce the radia l o s c i l l a t i o n amplitude over the phase range -5 deg to +25 deg F i g . 4.25 Accelerated phase p lots with o) = +15 deg for four points on the edge of the emittance e l l i p s e a) matched to v r = 1, and b) chosen to reduce the radia l o s c i l l a t i o n amplitude over the phase range -5 deg to + 25 deg (a) (b) F i g . 4.26 Accelerated phase p lots wi th d> = +25 deg for four points on the edge of the emittance e l l i p s e a) matched to v r = 1, and b) chosen to reduce the radia l o s c i l l a t i o n amplitude over the phase range -5 deg to +25 deg z Y ( in . ) F i g . 5.1 Cross-sect ion of a dee gap showing e l e c t r i c equ ipoten t ia ls ' I I I I I I I I I I I I I I 8.0 -4.0 0 4.0 8.0 distance from gap centre Y ( in . ) F i g . 5.2 E l e c t r i c p o t e n t i a l - v s d is tance from dee gap centre showing actual values and constant gradient approximation 147 Y Px p l/ 2 Fig. 5.3 Geometry of an ion crossing a dee gap n o 100 90 O S - 8 0 K 70 / / / / / / / / / • c - °° I = 8.97 i n . quadrat ic approximation cubic approximation numerical ly integrated values — — — l inear approximation i t e r a t i v e approximation 60h _L J I I L 5 10 Energy (MeV) 20 50 F i g . 5.4 Gap factors vs energy for <j> = 0 deg F i g . 5.5 Di f ferences between gap factors obtained from numerical in tegrat ion and those obtained from the constant gradient approximation as a funct ion of energy, no magnetic f i e l d T r Energy (MeV) F i g . 5-6 Di f ferences between gap factors obtained from numerical in tegra t ion and those obtained from the constant gradient approximation as a funct ion of energy, with an isochronous magnetic f i e l d r | l I I I l l l l_ -40 -20 0 20 40 RF phase at gap centre cj>c (degrees) F i g . 5.7 Di f ferences between gap factors obtained from numerical in tegrat ion and those obtained from the constant gradient approximation as a funct ion of RF phase, with an isochronous magnetic f i e l d F i g . 5-8 Apparent displacement due to change in radius of curvature of the ion path while cross ing the dee gap 153 Appendix A: THEORY OF SUCCESSIVE OVER-RELAXATION We wish to solve a system of equations descr ibed by * i j k = F * i - l j k + * i + l j k + * i j - i k + * i j + i k + * i j k -= b i j k + CD. ., , M j k+l [ i n t e r i o r nodes] [boundary nodes] 1 = 0 , 1 , 2 j = 0 , 1 , 2 k = 0 , 1 , 2 P q r The system contains N equations where N = (p + 1) (q + 1) (r + 1 ) . We w i l l s ta r t with some i n i t i a l approximation for each unknown value of <j> denoted ^jj^- We w i l l sequent ia l l y modify each of these values in the order <j> cj> . . . cp ty ty . . ty 111 211 P l l 121 221 P21 ty ty ty . . . ty ty Pqi 112 212 P12 P22 4> pq2 • • pqr or in the opposite order . The successive over - re laxa t ion method can be described by the i t e r a t i v e sequence. ,n+l n . a * i j k " * i j k + ~ = b. .. i j k A N + 1 '•• • J . n . .n+1.- . ,n n+1 n * | - l j k + * i+ l j k + * | j - l k + ^i j+lk + * f jk -1 + * i jk+l n 6 cpV i jk [ i n t e r i o r nodes] [boundary nodes] (A. l ) <j>?j^  is the n 1'' 1 estimate of the value of the value of the potent ia l at the node i jk and a is a constant. th . Now we def ine the er ror at the node i j k at the n i t e r a t i o n as 154 n n _ i jk ^i j k i j k (A.2) where ty... is the correct value at th is node, then I J K ' £n+l + _ n + -+ a i jk ^i j k i j k * i j k 6 e i - l j k + j k + £ i + l j k + j k + e i j ' l k + * i j - l k " * e i j + l k + j+ lk + e i j k - l + * i j k - l +  e i j k + l + *ijkH-1 " 6 e i j k " 6 * I j k ] / According to eqn . (2 .2 ) , the terms in ty in the square bracket c a n c e l , leaving n+1 n , a £. .. = e. ., + — i j k i j k 6 = 0 f. n+1 ^ n ^ n+1 , n , n+1 , n i - l j k i + l j k i j - l k i j + l k i j k - 1 i jk+1 c n - D E . . . i j k [ i n t e r i o r points] [boundary points] (A.3) or n+1 ,a £ i j k " 6 n+1 , n+1 , n+1 i - l j k i j - l k i j k - 1 n , a = e. ., + — i jk 6 n n e i + l j k e i j + l k + e ijk+1 C lear ly th is method of i t e r a t i o n leads to a l i nea r dependence of the e n+1 i jk IT. ': on the e. j^ , so we may wr i te and £n + 1 = Ke n - Ke n = K ^ " 1 (A.4) = Kne° where e n + ' and e1"1 are N~vectors whose elements are the N er rors a f te r n+1 and n i t e ra t ions r e s p e c t i v e l y . K is on N by N matrix which depends on a, p, q and r, but not on n. For an ind iv idua l e r ror e. j^ , eqn. (A.4) can be wr i t ten n+1 Y K c 1 1 -i j k 1 . '• i j k i - j ' k ' e i ' j " k ' i ' j ' k ' (A.5) 15S Now we denote the N eigenvalues of k by (£ = 1, 2 , . . . . N) and the corresponding eigenvectors by g^ s Kp£ = W (A.6) Since the e igenvectors form an orthogonal s e t , we can express the e r ro r vectors as a sum over the eigenvectors (A.7) from eqn.(A.k) n+1 (A.8) hence n+1 X £ c £ = " X £ C £ Now to eva luat ion the e igenva lues , we subs t i tu te ,eqns.(A.7) and (A.8) into ( A . 3 ) , g iv ing Y c n + 1 e k £ £ i j k £ £ i jk i -1 j k y c ne i + l jk Y C n + 1 R 1 Y r n R _L Y c n + 1 s ! j - l < T i j+lk ) 1 1 i j k -1 I S 3 £"£ i jk+1 £"£ i j k j Using the second part of e q n . ( A .8), th is becomes V n 1 S I. . jk 6 'g„' + V • p £ ; V. J I -1 j k p £ i + l jk + A , i j - l k i j + lk + X, g + r • • g„ P £ i jk -1 P £ i jk+1 = 0. But this must be true for any error en, i .e. for any set of c"; hence * X -1 + a 6 £ k J i j k a 6" i - l jk i + l jk i j - l k + X, i j + l k V. J ijk-1 ijk+1 (A.S)) I = 1 , 2 N and 3 Ojk i o k > i j o p j k i q k = 0 . (A.10) i j r To evaluate the eigenvectors and eigenvalues we wil l follow the pro-cedure f i r s t given by Frankel A more general treatment has been given by Young.1*0 The elements ijk of the eigenfunctions are evi dentlyW-' A i . TTS i -.j . TTt j _ k . TTUk = A si n B s i n — C s i n ijk (A.11) where s = 1 , 2 P - l t = 1 , 2 , q - 1 u = 1 , - 2 , r - l Substituting eqn.(A.11) Into eqn.(A.9) gives /, , , x A i . TT.SI D j • . rrtj _k . Truk (X-l + a)A sin—— BJ s in—_ C P s i n-q r a (A.12) Rj ^ r ^ f f t j r k . T r u k f . . i - 1 . TTS (T - 1 ) L . i + l . TTS ( i + l ) BJ s i n—— C s i n XA s i n + A si n—- -q r •[ p p , n i TTSI _k . i ruk + A si n C s i n J_ A' • ifsi J . TT t j + A si n BJ s i n—-P q ' j - l . T T t ( j - l ) , D j + 1 . TTt (j + 1 ) XBJ sin _ + BJ sin — -l q q f . r k - l . n 7 i u ( k - l ) , k+1 T r u . ( k + l)l XL si n . , , — + C si n-^H r ,157 For eqn.(A.12) to be s a t i s f i e d for a l l values of i , j and k, we must have A = A 2 , A = B 2 , A = C 2 . Since m u l t i p l i c a t i o n of A (or B or C) by -1 is equivalent to rep lac ing s by p - s (or t by q - t or u by r - u ) , we may take A = +B = +C. Then eqn.(A.12) becomes / . ? r . \ n i . TTS i . j . T T t j n k . TTUk (A z-1 + a)A s in A J s in—— A s in - = p q r a D" AJ • " T t J A k . TTUk _ . l + l . TTS I TTS A J s i n — A s i n 2A s i n c o s — q r p p ^ . i . TTS T . k . TTUk „ . i + l . T T t j TTt + A si n A s i n 2A s i n—— c o s — P r q q , . i . . TTS i . j . T T t j _ . i + l . TTUk TTU + A si n A s i n—— 2A s i n c o s — p q r r r . i . TTS j . j . T T t j .k . iruk A s i n A s i n—— A s i n TTS TTt TTU c o s — + c o s — + cos I P q r so ( A 2 - l + a) =-|A TTS TTt TTU C O S — - + C O S — + cos v P. 9 r A 2 - Aav + (a-1) = 0 (A.13) A = av ± / a 2 v 2 - k (a-1) (A.14) where v - T TTS TTt TTU C O S + C O S + C O S P q r = cos Now in order to invest igate the convergence rate we note that we have expressed the e r r o r vectors as l inear combinations of the e i g e n v e c t o r s , and eqn.(A.8) can be wr i t ten 158; e = I c £ h - lh c£ £ £ (A.15) We w i l l c a l l the X„ with the largest absolute value X £ 3 m. eqn. (A.15) as We can^then wr i te c° 3 + I •Xiv m m J £4m " r° ft c £ e £ ' but s i nee X > X„ , m Jl large n, goes to zero as n becomes large and we o b t a i n , for n o 0 ,n E = c 6„ X m £ m (A.16) So, to achieve the maximum convergence ra te , we want X (= A 2 , e t c . ) m to be as small as p o s s i b l e (X must be less than one i f the process is to m converge.) Returning to our equation for A, then i f we consider a 2 v 2 < 4(a - 1) , (A.17) the roots of eqn.(A.14) are complex conjugates with magnitude | A | 2 = a - 1; however, i f a 2 v 2 > 4(a ~ 0» the roots w i l l be real and unequal. Since the product of the roots is (a - 1), one of the roots must have a magnitude greater than /a - T. Hence, the minimum X = max | A i | 2 , | A £ | 2 occurs for a in the range a 2 v 2 < k(a - 1) . Since the magnitude of X^  in th is range is (a - 1 ) , the value of a1,, (cal led a^ ) g iv ing the smal lest X^  is the smal ler of the two roots of a 2 v 2 = h { % _ 1 ) f 2 2 - 2/W2 i.e. b 1 •+ sine = I + 1 + VW2" (A. 18) \53 and X = A 2 = m a b v 1 - sine 1 + s in - 1 = i ^ i - /f^2) Since we are c a l c u l a t i n g the minimum of the maximum values of A, we must take the worst case , i . e . the la rgest value of v , which is TT TT TT . cos—+ cos—+ cos — P q r (A.19) In p r a c t i c a l problems, p, q and r are >> 1, and we can obtain approxi mate expressions for a, and X b m v = 1 -1 1 1 l p z q z rf , sine L $ J _ + J L p 2 q 2 r 2 , (A.20) a b - 2 2 7 I _ L + _ L + _L p 2 q 2 r 2 (A.21) m 1 - 2TT / -/ 3 l p z q z r z = a. (A.22) Now that we have found the value of a which gives fas tes t convergence, the question of in te res t is how fast does i t converge. Referr ing to eqn.(A.8), each . i t e r a t i o n reduces each er ror by at least a fac tor X^ ; hence n? i t e ra t ions reduce the -e r ror by at least a fac tor (X ) n . Hence, to ' m • ' reduce the e r rors by a fac tor f , the number of i t e ra t ions r e q u i r e d ' i s = log f log 'A. (A.23) t 160 Appendix B. BOUNDARY CONDITIONS FOR RELAXATION CALCULATIONS The re laxat ion program requires that boundary condi t ions be set before c a l c u l a t i o n s t a r t s . This cons is ts of s e t t i n g the boundary value for every point which l i e s on a boundary. Since typ ica l problems contain 5 6 10 to 10 p o i n t s , some automatic method must be found. The re laxat ion program allows the user to supply a subroutine (BOUND) which returns boundary value when given the co-ord inates of each po in t . For complicated boundary shapes, th is subroutine may be complicated to wr i te and slow to execute. The program descr ibed here is fast and easy to use because i t takes advantage of two c h a r a c t e r i s t i c s of c y c l o t r o n -l i k e geometries. F i rs t , - these (three dimensional) geometries can be separated into several two dimensional geometries (planes) then the d e s c r i p t i o n of each plane and i ts v e r t i c a l extent completely descr ibes the three dimensional geometry. In the case of c y c l o t r o n s , i t is natural to take these planes p a r a l l e l to the median plane. Secondly, the geometry is each of these planes can be made up from r e l a t i v e l y simple shapes. If both these condi t ions are met then i t is poss ib le to devise a l inked l i s t s t ruc ture which allows the boundaries to be entered in a simple way and produces output s u i t a b l e for the re laxat ion program to read. In a d d i t i o n , the storage used by the program depends on the f i r s t power of the g r i d s i z e (the storage required would vary as the th i rd ) power of the g r id s i z e i f a l l points were s t o r e d ) . Consider a g r id as shown in F i g . 2 . 1 , a l ine of points with I and K constant is a column, with J and K constant is a row and a plane with K constant is a l e v e l . Now we choose to s tore information only about those points which f a l l on boundaries. The information stored i s , for each 161 l e v e l , those rows which have boundaries in them, and for each of these rows, the s t a r t and end column number of the boundary and i t s boundary va lue . Note that one row may have several "p ieces" of boundary in i t hence there may be several en t r ies for one row. The l i s t scheme may be depicted schemat ica l ly as f o l l o w s , for level K, supposing rows and have boundaries in them. pointers to K the s t a r t of the information for each level po in ter to next row number pointer to i nformation column # of s t a r t of boundary column # of end of boundary value pointer to more i nformation for th is row column # of s t a r t of boundary column # of end of boundary val ue pointer to more i nformat i on for th is row i po in ter to J2 end marker i nformation For example, i f in level three we have the boundaries shown in the fo l lowi ng f i gure 162 15 14 13 12 11 10 9 8 7 6 4 3 2 1 ! I 1 ! 1 1 ' i I i i r "\ boundary v, 1 s y K ) \ r \ 2 ( 1 1 boi ind; iry v \ \ 5 ; \ kboi nd; iry va ue -= 3 • s t a r t i n g column X ending column # value = 2 1 2 3 4 5 6 7 8 3 10 11 12 13 14 column numbers Then the l i s t which descr ibes th is would look l i k e K = 3 i t i 4 4 1 0 3 6 1 0 3 6 1 0 2 6 1 0 6 1 3 5 t 5 1 5 9 11 2 0 9 11 2 0 8 10 10 2 0 4 0 10 10 3 0 163 There is no r e s t r i c t i o n on the number of boundaries which may cross any row. A l l of the storage comes out of one pool as required so that i t is not necessary to know in advance how much storage w i l l be required for each level or row. A test problem contain ing about 10"' g r i d points required about 1500 words to store the boundary informat ion. Bu i ld ing the l i s t s cons is ts of reading a piece of the boundary and performing the fo l lowing steps;. 1. fo r each level invo lved , has a l i s t been star ted? i f not , s t a r t i t . . 2. search along the l i s t for th is level looking for the appropriate row number, i f the row number is not in the l i s t , enter i t . 3. search along the l i s t for th is row, for an entry which overlaps the column numbers of the current ent ry . J f an over lapping entry' is found,, modi fy- i t s s t a r t i n g <and endingi column jiumbers so that is includes both the o l d . e n t r y and the current en t ry . If no over lapping entry is found, inser t the current en t ry . k. go on to the next row The l i s t s are maintained in order by\ row number but the en t r ies for each row number are unordered. Wr i t ing a tape conta in ing values for every point requires an .exhaustive search of the l i s t for each point s ince i t is not known that a p o i n t , i s not on a boundary u n t i l an entry fo r th is point cannot be found in the l i s t . 5 This is done taking advantage of the fact that many leve ls are the same and is qui te f a s t . The sample problem mentioned above required 0.6 minutes on an IBM 360/67 to set the boundaries and wr i te the tape for the re laxat ion program. DATA REQUIRED 1. P rob 1 em Setup f i r s t card (3F10.0, 31S) 1) minimum X of g r i d 2) minimum Y of gr id 3) g r i d spacing h) # rows (a row has X = constant) 5) # columns (a column has Y = constant) 6) # leve ls second, t h i r d . . . cards (315) ,. 1) representat ive level number 2) level number of bottom of th is representat ive level 3) level number of top of th is representat ive level subsequent cards def ine other representat ive l e v e l s , up to 32 are a l lowed, they can be entered in any order . This input should be terminated by a blank c a r d . Next card (3F10.0) 1) the potent ia l value to be dumped fo r boundary value 1 2) the potent ia l value to be dumped for boundary value 2 3) the potent ia l value to be dumped for boundary value 3 The re laxat ion program requires that the boundary condi t ions be in the range 0.0 to - 1 . 0 . BDRY requires that the boundary values be 1, 2 or 3- The above input allows the conversion to be made. 2. Descr ip t ion of Boundaries The shapes which the boundary must be broken into are type = 1 type = 2 type = 3 165 These areas may overlap and may extend outside the g r i d , One data card is required for each area. (215, 6 F I 0 . 0 , 12, IX, 212) PI , P 2 . . . P 7,P8, P9 ,P10 Rectangle C i r c l e Annulus PI = 1 PI =2 PI = 3 P2 X X, X P3 Y Y Y Pk 6 R 6] P5 A 02 P6 B R, P7 R 2 P8 the representat ive level number of the s t a r t of th is sec t ion of boundary P9"' the representat ive level number of the end of th is sect ion of boundary P10 the boundary value The program requires 6,<02 and the in terva l 8 j , 82 must not contain zero (some annuli w i l l have to be entered in two p a r t s ) . As many data cards as required can be used,/, termi nated by a blank card . 3. Output of Resu l ts . ( 2 F I 0 . 0 ) PI , P2 Two types of output are a v a i l a b l e 1) a pr in tout of 'the boundary values at each g r i d point for one level 2) a dump of the boundary information in a form that the re laxat ion routine RESTOR can read. A s i n g l e card is required (for e i t h e r output ) . pj 1 fo r dump of one level onto p r i n t e r 2 for dump of a l l boundaries for re laxat ion program P2 i f dump on p r i n t e r , = level number to be dumped i f dump fo r re laxat ion program, = l o g i c a l uni t to dump onto A se r ies of these may be used (for example to d isp lay several leve ls on the p r i n t e r then dump onto tape) . This input should be terminated by a blank card . 166 I N T E G E R L O R O W , H I ROW * L O C O L , H I C O L I N T E G E R I S T A R T ( 1 0 ) , I E N D ( 1 0 ) , V A L ( 1 0 ) , H E A D L ( 2 0 ) » H E A D R ( 5 0 0 , 3 ) , 1 I N F 0 ( 6 0 0 0 ) , P O I N T C O M M O N I P L A C E , I S T A R T , I E N D t V A L , H E A D L , H E A D R , I N F O t I I N F O , I H E A D R , P O I N T C A L L S E T ( B E G IN ) C O M M O N / Q U A / Q U A L ( 3 ) C O M M O N / S I Z E / N R O W , N C O L , N L E V C O M M O N / C Q R R / U N R L ( 2 0 ) , B O T ( 2 0 ) , T O P ( 2 0 ) , N U M B I N T E G E R U N R L , B O T , T O P C R E A D G R I D S P E C S R E A D ( 5 , 1 0 0 ) X 0 , Y 0 , D E L T , N R O W , N C O L , N L E V 1 0 0 F O R M A T ( 3 F 1 0 . 0 , 3 1 5 ) W R I T E ( 6 , 1 0 1 ) X O , Y O , D E L T , N R O W , N C O L , N L E V 1 0 1 F O R M A T ( ' 1 ' , 1" ' , ' G R I D P O I N T 1 , 1 I S A T X = ' , F 1 0 . 3 , ' Y = ' , F 1 0 . 3 , / 1 » ' , ' G R I D S P A C I N G I S = ' , F 1 0 . 3 / 2 • ' , ' G R I D S I Z E ( R O W B Y C O L B Y L E V E L ) I S ' , 6 1 5 , ' B Y ' , 1 5 , ' B Y ' , 1 5 / 3 ' I N C R E A S I N G ROW N U M B E R I S I N D I R E C T I O N O F I N C R E A S I N G X ' / 4 ' I N C R E A S I N G C O L U M N N U M B E R I S I N D I R E C T I O N O F I N C R E A S I N G Y ' / / ) 1 = 0 2 3 4 1 = 1 + 1 R E A D ( 5 , 2 3 2 ) U N R L ( I ) , B O T ( I ) , T O P ( I ) 2 3 2 F O R M A T ( 3 1 5 ) I F ( U N R L ( I ) . N E , 0 ) G 0 T O 2 3 4 N U M B = I - 1 DO 2 3 6 1 = 1 , N U M B W R I T E ( 6 , 2 3 7 ) U N R L ( I ) , B O T ( I ) , T O P ( I ) 2 3 7 F O R M A T ( ' L E V E L ' , 1 3 , ' E X T E N D S F R O M ' , 1 3 , ' T O ' , 1 3 ) 2 3 6 C O N T I N U E W R I T E ( 6 , 8 0 3 ) 8 0 3 F O R M A T ( / / ) R E A D ( 5 , 8 0 5 ) ( Q U A L ( I ) , I = 1 , 3 ) 8 0 6 F O R M A T ( I X , • I N T E R N A L V A L U E = ' , 1 3 , ' V A L U E D U M P E D = ' , F 1 0 . 7 ) D O 8 0 4 1 = 1 , 3 W R I T E ( 6 , 8 0 6 ) I , O U A L ( I ) 8 0 4 C O N T I N U E 8 0 5 F O R M A T ( 3 F 1 0 . 0 ) W R I T E ( 6 , 8 0 2 ) 8 0 2 F O R M A T ( I X , ' I N P U T D A T A ' ) C R E A D B O U N D A R Y S P E C S 9 0 0 R E A D ( 5 , 1 0 2 , E N D = 9 9 6 ) I T Y P E , V A L U E , T 1 , T 2 , T 3 , T 4 , T 5 , T 6 , I A A , I A B C A L L C L O C K 1 0 2 F O R M A T ( 2 I 5 , 6 F 1 0 . 0 , I 2 , 1 X , I 2 ) C C C H E C K F O R I N V A L I D C O D E I F ( I T Y P E . E Q . O ) G 0 T O 9 9 6 I F ( I T Y P E . G T . O . A N D . I T Y P E . L T . 5 ) G O T O 5 W R I T E ( 6 , 1 0 3 ) I T Y P E , V A L U E , T 1 , T 2 , T 3 , T 4 , T 5 , T 6 , I A A , I A B 1 0 3 F O R M A T ( ' I N V A L I D T Y P E C O D E , O F F E N D I N G C A R D I S ' / 1 1 X , 2 I 5 , 6 F 1 0 . 3 , 2 I 4 ) G O T O 9 0 0 C C 5 C 1 B R A N C H F O R D I F F E R E N T B O U N D A R Y A R E A T Y P E S GO T O ( 1 , 2 , 3 ) , I T Y P E T Y P E 1 T H E A R E A I S A R E C T A N G L E X = T 1 Y = T 2 T H E T A = T 3 167 A = T 4 B = T 5 W R I T E ( 6 , 1 1 0 ) X , Y , T H E T A , A , B , V A L U E , I A A , I A B 1 1 0 F O R M A T ( ' R E C T A N G L E • , T 1 1 , ' X = ' , F 9 . 3 , T 2 4 , • Y = ' , F 9 . 3 , T 3 7 , 1 ' T H E T A = » , F 9 . 3 , T 5 5 , ' A = • , F 9 . 3 , T 7 3 , ' B = ' , F 9 . 3 , T 1 0 3 , • V A L U E = ' , 1 2 , 1 T 1 1 3 , ' L E V E L S ' , 1 2 , • T O ' , 1 2 ) T H E T A = T H E T A / 5 7 . 2 9 5 7 8 D I A G = S O R T ( A * A + B * B ) A N G = A T A N ( B / A ) L O C O L = I F I X ( ( Y ™ Y O ) / D E L T ) H I C O L = I F I X ( ( Y + D I A G * S I N ( T H E T A + A N G ) - Y O ) / D E L T ) + 1 L O R O W = I F I X ( ( X - B * S I N ( T H E T A ) - X O ) / D E L T ) H I R O W = I F I X ( ( X + A * C O S ( T H E T A ) - X 0 ) / D E L T ) + 1 I F ( L O R O W . L T . l ) L 0 R 0 W = 1 I F ( L 0 C 0 L . L T . l ) L 0 C 0 L = 1 I F ( H I R O W . G T . N R O W ) H I R 0 W = N R 0 W I F ( H I C O L . G T . N C O L ) H I C O L = N C O L C W R I T E ( 6 , 8 7 6 ) L O R O W , H I R O W , L O C O L , H I C O L C 8 7 6 F O R M A T ( ' L 0 R 0 W = ' , I 4 , ' H I R 0 W = ' , I 4 , ' L O C O L = ' , 1 4 , • H I C 0 L = ' , I 4 ) D O 1 0 I = L O R O W , H I R O W D O 1 1 J = L 0 C 0 L , H I C O L X X = F L O A T ( 1 - 1 ) * D E L T + X O Y Y = F L O A T ( J - 1 ) * D E L T + Y O C C T R A N S F O R M T O C O O R D I N A T E S Y S T E M O R I E N T E D W I T H R E C T A N G L E X S = X X Y S = Y Y X X = ( X S - X ) * C O S ( T H E T A ) + ( Y S - Y ) * S I N ( T H E T A ) Y Y = ( Y S - Y ) * C O S ( T H E T A ) ~ ( X S - X ) * S I N ( T H E T A ) C I F ( X X . G E . O . O . A N D . X X . L E . A . A N D . Y Y . G E . 0 . 0 . A N D . Y Y . L E . B ) C * W R I T E ( 6 , 8 8 4 ) X S , Y S C 8 8 4 F 0 R M A T ( 1 X , 2 E 1 2 . 3 ) I F ( X X . G E . 0 . 0 . A N D . X X . L E . A . A N D . Y Y . G E . 0 . 0 . A N D . Y Y . L E . B ) 1 C A L L S A V E ( J , V A L U E ) 1 1 C O N T I N U E I F ( I P L A C E . N E . O ) C A L L I N S E R T ( I , I A A , I A B ) DO 7 8 1 I Q Z = 1 , I P L A C E I S T A R T ( I Q Z ) = 0 I E N D ( I Q Z ) = 0 7 8 1 V A L ( I Q Z ) = 0 I P L A C E = 0 1 0 C O N T I N U E C G O T O 9 0 0 C C C C T Y P E 2 , T H E A R E A I S A C I R C L E 2 X = T 1 Y = T 2 R = T 3 W R I T E ( 6 , 1 2 0 ) X , Y , R , V A L U E , I A A , I A B 1 2 0 F O R M A T ( ' C I R C L E • , T 1 1 , ' X = • , F 9 . 3 , T 2 4 , • Y = ' , F 9 . 3 , T 3 7 , » R = ' , F 9 . 3 , 1 T 1 0 3 , • V A L U E = ' , 1 2 , T 1 1 3 , ' L E V E L S ' , 1 2 , • T O » , I 2 ) C L O C O L = I F I X ( ( Y » R - Y O ) / D E L T ) H I C O L = I F I X ( ( Y + R » Y O ) / D E L T ) + l L O R O W = I F I X ( ( X » R - X O ) / D E L T ) H I R O W = I F I X ( ( X + R - X O ) / D E L T ) + l I F ( L O R O W . L T . l ) L 0 R 0 W = 1 168 I F ( L O C O L . L T . l ) L O C O L = l I F ( H I R O W . G T . N R O W ) H I ROW =N ROW I F ( H I C O L . G T . N C O L ) H I C O L = N C O L DO 2 0 I = L O R O W , H I R O W D O 2 1 J = L O C O L , H I C O L X X = F L O A T ( 1 - 1 ) * D E L T + X O Y Y = F L O A T ( J - 1 ) * D E L T + Y O C I F ( ( X X - X ) # # 2 + ( Y Y - Y ) * * 2 . L E . R * R ) W R I T E ( 6 , 8 8 4 ) X X , Y Y I F ( ( X X - X ) * * 2 + ( Y Y - Y ) * * 2 . L E . R * R ) C A L L S A V E ( J , V A L U E ) C 2 1 C O N T I N U E I F ( I P L A C E . N E . 0 ) C A L L I N S E R T ( I , I A A , I A B ) D O 7 8 2 I Q Z = 1 , I P L A C E I S T A R T ( I O Z ) = 0 I E N D ( I O Z ) = 0 7 8 2 V A L ( I Q Z ) = 0 I P L A C E = 0 2 0 C O N T I N U E G O T O 9 0 0 C C C C T Y P E 3 , T H E A R E A I S A N A N N U L U S 3 X = T 1 Y = T 2 T H E T A 1 = T 3 T H E T A 2 = T 4 R1 = T 5 R 2 = T 6 W R I T E ( 6 , 1 3 0 ) X , Y , T H E T A l , T H E T A 2 , R 1 , R 2 , V A L U E , I A A , I A B 1 3 0 F O R M A T ( ' A N N U L U S ' , T 1 1 , ' X = « , F 9 . 3 , T 2 4 , • Y = ' , F 9 . 3 , T 3 7 , • T H E T A 1= ' 1 F 9 . 3 , T 5 5 , ' T H E T A 2 = • , F 9 . 3 , T 7 3 , • R 1 = ' , F 9 . 3 , T 8 8 , » R 2 = ' , F 9 . 3 , T 1 0 3 , l ' V A L U E = ' , 1 2 , T 1 1 3 , ' L E V E L S ' , 1 2 , • T O ' , 1 2 ) T H E T A 1 = T H E T A 1 / 5 7 . 2 9 5 7 8 T H E T A 2 = T H E T A 2 / 5 7 . 2 9 5 7 8 C C 9 0 = l . 5 7 0 7 9 6 3 C 1 8 0 = 3 . 1 4 1 5 9 2 7 C 2 7 0 = 4 . 7 1 2 3 8 9 0 I A X = I F I X ( ( X - R 2 * C 0 S ( C 1 8 0 - T H E T A 2 ) - X O ) / D E L T ) I A Y = I F I X ( ( Y + R 2 * S I N ( C 1 8 0 - T H E T A 2 ) - Y O ) / D E L T ) I B X = I F I X ( ( X - R 1 * C 0 S ( C 1 8 0 - T H E T A 2 ) - X 0 ) / D E L T ) I B Y = I F I X ( ( Y + R 1 * S I N ( C 1 8 0 - T H E T A 2 ) - Y 0 ) / D E L T ) I C X = I F I X ( ( X + R 2 * C 0 S ( T H E T A 1 ) - X O ) / D E L T ) I C Y = I F I X ( ( Y + R 2 * S I N ( T H E T A 1 ) - Y O ) / D E L T ) I D X = I F I X ( ( X + R 1 * C 0 S ( T H E T A 1 ) - X O ) / D E L T ) I D Y = I F I X ( ( Y + R 1 * S I N ( T H E T A 1 ) - Y 0 ) / D E L T ) I X = I A X I Y = I A Y J X = I A X J Y= I A Y I F ( T H E T A 1 . L T . C 9 0 . A N D . T H E T A 2 . G T . C 9 0 ) I Y = I F I X ( ( Y + R 2 - Y 0 ) / D E L T ) I F ( T H E T A 1 . L T . C 1 8 0 . A N D . T H E T A 2 . G T . C 1 8 0 ) J X = I F I X ( ( X - R 2 - X 0 ) / D E L T ) I F ( T H E T A 1 . L T . C 2 7 0 . A N D . T H E T A 2 . G T . C 2 7 0 ) J Y = I F I X ( ( Y - R 2 - Y 0 ) / D E L T ) I F ( T H E T A 1 . L T . 0 . 0 . A N D . T H E T A 2 . G T . 0 . 0 ) I X = I F I X ( ( X + R 2 - X 0 ) / D E L T ) L 0 C 0 L = M I N 0 ( I A Y , I B Y , I C Y , I D Y , J Y ) H I C O L = M A X O ( I A Y , I B Y , I C Y , I D Y , I Y ) + l L O R O W = M I N O ( I A X , I B X , I C X , I D X , J X ) H I R O W = M A X O ( I A X , I B X , I C X , I D X , I X ) + l I F t L O R O W . L T . l ) L 0 R 0 W = 1 .169 I F I L O C O L . L T . l ) L 0 C 0 L = 1 I F ( H I R O W . G T . N R Q W ) H I R O W = N R O W I F ( H I C O L . G T . N C O L ) H I C O L = N C O L D O 3 0 I = L O R O W , H I R O W DO 3 1 J = L O C O L , H I C O L X X = F L O A T ( I - l ) * D E L T + X 0 Y Y = F L O A T ( J - l ) * D E L T + Y 0 C T R A N S F O R M T O P O L A R C O O R D I N A T E S C R R = S Q R T ( ( X X - X ) * * 2 + ( Y Y - Y ) # * 2 ) I F ( R R . E Q . 0 . 0 ) G 0 T 0 7 1 4 T T = A T A N 2 ( Y Y - Y , X X - X ) I F ( T T . L T . 0 . 0 ) T T = T T + 6 . 2 8 3 1 8 5 2 C I F ( T T . G E . T H E T A 1 . A N D . T T . L E . T H E T A 2 . A N D . C * R R . G E . R 1 . A N D . R R . L E . R 2 ) W R I T E ( 6 , 8 2 3 ) C * T T , T H E T A 1 , T H E T A 2 , R R , R 1 , R 2 , X X , Y Y C 8 2 3 F O R M A T ( I X , 8 E 1 2 . 3 ) C I F ( T T . G E . T H E T A 1 . A N D . T T . L E . T H E T A 2 . A N D . 1 R R . G E . R 1 . A N D . R R . L E . R 2 ) C A L L S A V E ( J , V A L U E ) 7 1 4 C O N T I N U E C 3 1 C O N T I N U E I F ( I P L A C E . N E . O J C A L L I N S E R T ( I , I A A , I A B ) D O 7 8 3 I Q Z = 1 , I P L A C E I S T A R T ( I Q Z ) = 0 I E N D ( I Q Z ) = 0 7 8 3 V A L ( I Q Z ) = 0 I P L A C E = 0 3 0 C O N T I N U E GO T O 9 0 0 C C C 9 9 9 R E A D ( 5 , 2 3 1 , E N D = 9 9 9 9 ) I J , I K 2 3 1 F 0 R M A T ( 2 I 3 ) I F ( I J . E G . O ) G O T O 9 9 9 9 I F ( I J . E 0 . 1 ) C A L L O U T P U T ( N R O W , N C O L , B E G I N , T L A S T , I K ) I F ( I J . E Q . 2 ) C A L L D U M P ( I K ) 9 9 6 W R I T E ( 6 , 1 0 7 ) I H E A D R , I I N F 0 1 0 7 F O R M A T ( I X , 1 5 , • P L A C E S U S E D I N ROW H E A D R A R R A Y ' / 1 1 X , I 5 , » P L A C E S U S E D IN I N F O R M A T I O N A R R A Y ' ) GO T O 9 9 9 9 9 9 9 S T O P E N D S U B R O U T I N E S A V E ( N C O L , V A L U E ) I N T E G E R I S T A R T ( 1 0 ) , I E N D ( 1 0 ) , V A L ( 1 0 ) , H E A D L ( 2 0 ) , H E A D R ( 5 0 0 , 3 ) , 1 I N F 0 ( 6 0 0 0 ) , P O I N T C O M M O N I P L A C E , I S T A R T , I E N D , V A L , H E A D L , H E A D R , I N F O , I I N F O , I H E A D R , P O I N T I N T E G E R V A L U E I F ( I P L A C E . E Q . O ) G 0 T O 1 I F ( V A L U E . E Q . V A L ( I P L A C E ) ) G O T O 2 1 I P L A C E = I P L A C E + 1 I S T A R T ( I P L A C E ) = N C O L I E N D ( I P L A C E ) = N C O L V A L ( I P L A C E ) = V A L U E C W R I T E ( 6 , 6 6 ) I P L A C E , V A L ( I P L A C E ) C 6 6 F O R M A T ( • I P L A C E = ' , 1 5 , • V A L ( I P L A C E ) = ' , I 5 ) R E T U R N 2 I F ( N C O L . N E . I E N D ( I P L A C E ) + 1 ) G O T O 1 I E N D ( I P L A C E ) = N C O L " R E T U R N E N D S U B R O U T I N E S E T I N T E G E R I S T A R T ( 1 0 ) , I E N D ( 1 0 ) , V A L ( 1 0 ) , H E A D L ( 2 0 ) , H E A D R ( 5 0 0 , 3 ) , 1 I N F O ( 6 0 0 0 ) , P 0 I N T C O M M O N I P L A C E , I S T A R T , I E N D , V A L , H E A D L , H E A D R , I N F O , I I N F O , I H E A D R , P O I N T DO 1 1 = 1 , 2 0 1 H E A D L ( I ) = 0 DO 2 1 = 1 , 5 0 0 D O 2 J = l , 3 2 H E A D R ( I , J ) = 0 D O 3 I = 1 , 6 0 0 0 3 I N F O ( I ) = 0 D O 4 1 = 1 , 1 0 I S T A R T ( I ) = 0 I E N D ( I ) = 0 4 V A L ( I ) = 0 I I N F 0 = 1 I H E A D R = 1 I P L A C E = 0 R E T U R N E N D S U B R O U T I N E I N S E R T ( N R O W , I A A , I A B ) D I M E N S I O N L E V E L ( 2 0 ) I N T E G E R I S T A R T ( 1 0 ) , I E N D ( 1 0 ) , V A L ( 1 0 ) , H E A D L ( 2 0 ) , H E A D R ( 5 0 0 , 3 ) , 1 I N F 0 ( 6 0 0 0 ) , P O I N T I N T E G E R S T A R T , E N D , V A L U E C O M M O N I P L A C E , I S T A R T , I E N D , V A L , H E A D L , H E A D R , I N F O , I I N F O , I H E A D R , P O I N T C I N I T I A L L Y , L E V E L H E A D E R S A R E S E T T O Z E R O C I I N F O P O I N T S T O T H E F I R S T E M P T Y S P A C E I N T H E I N F O A R R A Y C I H E A D R P O I N T S T O T H E F I R S T E M P T Y S P A C E I N T H E H E A D R A R R A Y C L O O P O V E R T H E A R R A Y L E V E L T O S E E W H I C H L E V E L S C T O E N T E R T H E B O U N D A R Y C O N D I T I O N S I N T O C 5 5 5 C O N T I N U E D O 8 0 0 I = I A A , I A B C C H E A D L ( I ) P O I N T S T O T H E F I R S T E N T R Y I N T H E L I S T O F ROW N U M B E R S C I N D E X = H E A D L ( I ) C C I F I N D E X = 0 , T H E ROW L I S T F O R T H I S L E V E L I S E M P T Y , S T A R T I T C I F ( I N D E X . N E . 0 ) G 0 T O 1 5 0 C H E A D L ( I ) = I H E A D R I N D E X = I H E A D R I H E A D R = I H E A D R + 1 H E A D R ( I N D E X , 1 ) = N R O W C W R I T E ( 6 , 5 0 3 ) H E A D R ( I N D E X , 1 ) , N R O W C 5 0 3 F O R M A T ( 1 H E A D R ( I N D E X , 1 ) = • , 1 5 , 5 X , ' N R O W = • , I 5 ) G O T O 6 0 0 C C I S T H E C U R R E N T E N T R Y I N T H E ROW N U M B E R L I S T T H E R E Q U I R E D O N E ? C 1 5 0 I F ( N R O W . E Q . H E A D R ( I N D E X , 1 ) ) G 0 T O 6 0 0 C I T I S N O T T H E R E Q U I R E D O N E S H O U L D I T B E I N S E R T E D B E F O R E C T H E F I R S T E N T R Y I N T H E L I S T ? I F ( ( N R O W . L T . H E A D R ( I N D E X , 1 ) ) . A N D . ( I N D E X . E Q . H E A D L ( I ) ) ) G O T O 1 9 7 171 C C I T I S N O T T H E R E Q U I R E D O N E I S I T T H E L A S T O N E ? C I F ( H E A D R ( I N D E X , 3 ) . E O . O ) G O T O 1 9 8 C C I S I T B R A C K E T E D B Y T H E C U R R E N T O N E A N D T H E N E X T O N E ? C I F ( N R O W . G T . H E A D R ( I N D E X , 1 ) . A N D . N R O W . L T . H E A D R ( H E A D R ( I N D E X , 3 ) , 1 ) 1 ) G O T O 1 9 8 C C O T H E R W I S E , G O O N T O T H E N E X T O N E C I N D E X = H E A D R ( I N D E X , 3 ) G O T O 1 5 0 C C I N S E R T A ROW H E A D E R F O R N R O W A F T E R T H E C U R R E N T E N T R Y 1 9 8 I T E M P = H E A D R ( I N D E X , 3 ) H E A D R ( I N D E X , 3 ) = I H E A D R H E A D R ( I H E A D R , 1 ) = N R O W H E A D R ( I H E A D R , 3 ) = I T E M P I N D E X = I H E A D R I H E A D R = I H E A D R + 1 GO T O 6 0 0 C I N S E R T A ROW H E A D E R F O R N R O W B E F O R E T H E F I R S T E N T R Y I N T H E L I S T 1 9 7 I T E M P = H E A D L ( I ) H E A D L ( I ) = I H E A D R H E A D R ( I H E A D R , 1 ) = N R O W H E A D R ( I H E A D R , 3 ) = I T E M P I N D E X = I H E A D R I H E A D R = I H E A D R + 1 C C T H E L I S T F O R N R O W I S S T A R T E D , I N S E R T T H E E N T R I E S C C 6 0 0 D O 3 0 0 K = l , 1 0 C W R I T E ( 6 , 1 0 2 1 ) I S T A R T ( K ) , I E N D ( K ) , V A L ( K ) , N R O W , I A A , I A B C 1 0 2 1 F 0 R M A T ( 1 X , 6 I 8 ) C I F I S T A R T I S Z E R O , A L L E N T R I E S H A V E B E E N M A D E C W R I T E ( 6 , 5 0 4 ) I S T A R T ( K ) C 5 0 4 F O R M A T ( ' I S T A R T ( K ) = • , I 5 ) I F ( I S T A R T ( K ) , E Q . O ) G O T O 3 0 1 C N D E X = H E A D R ( I N D E X , 2 ) C W R I T E ( 6 , 5 0 5 ) N D E X C 5 0 5 F O R M A T ( ' N D E X = « , 1 5 ) C C I F N D E X = 0 , T H E L I S T I S E M P T Y , S T A R T I T 7 7 7 I F ( N D E X . N E . O ) G O T O 7 0 0 C I N S E R T A NEW E N T R Y H E A D R ( I N D E X , 2 ) = I I N F O N D E X = I I N F O C A L L P A C K ( I S T A R T ( K ) , I E N D ( K ) , V A L ( K ) , 0 , I N F O ( N D E X ) ) I I N F O = I I N F O +1 G O T O 3 0 0 C C U N P A C K T H E C U R R E N T E N T R Y 7 0 0 C A L L U N P A C K ( S T A R T , E N D , V A L U E , P O I N T , I N F O ( N D E X ) ) C D O T H E I N T E R V A L S I N T E R S E C T ? I F ( S T A R T . L E . I S T A R T ( K ) . A N D . E N D . G E . I E N D ( K ) . A N D . V A L ( K ) . E Q . V A L U E ) 1 G 0 T O 3 0 0 172 C I F T H E Y D O N ' T I N T E R S E C T G O O N T O T H E N E X T O N E I F ( S T A R T . G T . I E N D ( K ) . O R . E N D . L T . I S T A R T ( K ) ) G O T O 7 0 1 C I F T H E Y I N T E R S E C T C H E C K V A L U E S 7 0 6 I F ( V A L ( K ) . N E . V A L U E ) G 0 T O 7 0 7 C V A L U E S A R E T H E S A M E M O D I F Y E N D P O I N T S I F ( I S T A R T ( K ) . L T . S T A R T ) S T A R T = I S T A R T ( K ) I F ( I E N D ( K ) . G T . E N D ) E N D = I E N D ( K ) C A L L P A C K ( S T A R T , E N D , V A L U E , P O I N T , I N F O ( N D E X ) ) GO T O 3 0 0 7 0 7 W R I T E ( 6 , 8 1 8 ) I S T A R T ( K ) , I E N D ( K ) , V A L ( K ) , S T A R T , E N D , * V A L U E , N R O W , I 8 1 8 F O R M A T ( I X , ' A T T E M P T T O I N S E R T E N T R Y S T A R T = ' , I 4 , * • E N D = ' , 1 4 , ' V A L U E = ' , 1 4 , ' C O N F L I C T S W I T H E N T R Y S T A R T = • , * I 4 , • E N D = ' , 1 4 , ' V A L U E = ' , 1 4 , 1 A T R O W ' , 1 4 , * L E V E L ' , 1 4 ) G O T O 3 0 0 C C GO ON T O T H E N E X T E N T R Y 7 0 1 N S A V E = N D E X N D E X = P O I N T C I F N D E X = 0 , T H E E N D O F T H E L I S T H A S B E E N R E A C H E D I F ( N D E X . N E . O ) G 0 T O 7 0 0 C I N S E R T A N E W E N T R Y C S E T N E W P O I N T E R C A L L P A C K I S T A R T , E N D , V A L U E , I I N F O , I N F O ( N S A V E ) ) C P U T T H E I N F O I N C A L L P A C K ( I S T A R T ( K ) , I E N D ( K ) , V A L ( K ) , 0 , I N F O ( I I N F O ) ) I I N F O = I I N F O + 1 3 0 0 C O N T I N U E 3 0 1 C O N T I N U E 8 0 0 C O N T I N U E 5 5 6 C O N T I N U E R E T U R N E N D S U B R O U T I N E P A C K ( S T A R T , E N D , V A L U E , P O I N T , Z ) C T H E I N F O R M A T I O N I S P A C K E D A S F O L L O W S , B I T S N U M B E R E D R I G H T T O L E F T C P O I N T E R F I R S T 1 3 B I T S C C O L U M N N U M B E R O F E N D N E X T 8 B I T S C V A L U E O F B O U N D A R Y C O N D I T I O N N E X T 2 B I T S C C O L U M N N U M B E R O F S T A R T N E X T 8 B I T S C Z = 2 * * 2 3 * S T A R T + 2 * * 2 1 * V A L U E + 2 * * 1 3 * E N D + P 0 I N T E R I N T E G E R S T , E N , V A , P 0 , Z I N T E G E R S T A R T , E N D , V A L U E , P O I N T , Z , S H F T L Z = P O I N T + S H F T L ( E N D , 1 3 ) + S H F T L ( V A L U E , 2 1 ) + S H F T L ( S T A R T , 2 3 ) C C A L L U N P A C K ( S T , E N , V A , P O , Z ) C I F ( S T A R T . N E . S T . O R . E N D . N E . E N . O R . V A . N E . V A L U E . O R . P O . N E . P O I N T ) S T O P 1 2 3 4 R E T U R N E N D S U B R O U T I N E U N P A C K ( S T A R T , E N D , V A L U E , P O I N T , Z ) I N T E G E R S T A R T , E N D , V A L U E , P O I N T , Z , S H F T R D A T A M 1 / Z 0 0 0 0 1 F F F / , M 2 / Z 0 0 1 F E 0 0 0 / , M 3 / Z 0 0 6 0 0 0 0 0 / , M 4 / Z 7 F 8 0 0 0 0 0 / S T A R T = S H F T R ( L A N D ( M 4 , Z ) , 2 3 ) V A L U E = S H F T R ( L A N D ( M 3 , Z ) , 2 1 ) E N D = S H F T R ( L A N D ( M 2 , Z ) , 1 3 ) P O I N T = L A N D ( M l , Z ) R E T U R N E N D S U B R O U T I N E O U T P U T ( N R O W , N C O L , B E G I N , T L A S T , K ) C T H I S S U B R O U T I N E E X A M I N E S T H E V A L U E O F E A C H P O I N T I N C T H E A R R A Y W H I C H H A S B E E N S E T U P F R O M T H E B O U N D A R Y C O N D I T I O N S c c c c c c c c ' 1<73 THERE ARE FOUR POSSIBLE VALUES AT EACH POINT THESE ARE AND WILL BE PRINTED AS FOLLOWS BOUNDARY VALUE 1 BOUNDARY VALUE 2 BOUNDARY VALUE 3 NO BOUNDARY VALUE 1 2 3 0 DIMENSION I J ( I O O ) INTEGER ONE,TWO,THRE,BLANK,X INTEGER I E N D ( 1 0 ) , I S T A R T ( 1 0 ) DATA O N E / l l , / , T W O / , 2 , / , T H R E / , 3 , / , B L A N K / ' '/,X/'X'/ INTEGER V A L ( I O ) , H E A D L ( 2 0 ) , H E A D R ( 5 0 0 , 3 ) , I N F 0 ( 6 0 0 0 ) , P O I N T COMMON I PLACE,ISTART,I END,VAL,HEADL,HEADR,INFO,I INFO,IHEADR,P0INT COMMON/L/LINE(250) CALL CLOCK I F ( H E A D L ( K ) . N E . 0 ) G 0 TO 1 WRITE(6,10)K 10 FORMAT(• LEVEL ',I2,« IS EMPTY') GO TO 99 1 WRITE(6,11)K 11 FORMAT( • 1 • , 'LEVEL ',12) IS = 1 I JK=0 IE=NCOL IF(NCOL.GE.101) IE=IS+99 13 DO 100 I=1,NR0W DO 201 J = l , 1 0 0 201 I J ( J ) = B L A N K CALL B O U N D ( K , I , I S , I E ) DO 101 J = I S , I E IB = L I N E ( J ) IND=J-IJK ITEMP=X I F ( IB .EQ.O)ITEMP=BLANK I F ( I B . E Q . l ) I T E M P = ONE I F ( IB .EQ.2)ITEMP=TWO I F ( IB.EQ.3 ) IT EM P =THRE 101 I J ( IND)=ITEMP W R I T E ( 6 , 2 2 2 ) ( I J ( J ) , J = 1 , 1 0 0 ) , I 222 F0RMAT(1X,100A1,5X,I5) 100 CONTINUE IF ( IE .GE .NCOL) GO TO 99 IS=IE+1 IJK= I S - l IE=IS+99 IF(IE.GT.NCOL)IE=NCOL GO TO 13 99 RETURN END SUBROUTINE DUMP(NTAPE) COMMON/SIZE/NROW,NCOL,NLEV COMMON/CORR/UNRL(20),BOT(20),TOP(20) , NUMB COMMON/L/LINE(250) COMMON/QUA/QUAL(3) INTEGER UNRL,BOT,TOP C C Uh D I M E N S I O N B ( 1 6 , 1 6 , 8 ) C A L L C L O C K I B L K S Z = 2 0 4 8 W R I T E ( 6 , 1 0 0 ) N T A P E 1 0 0 F O R M A T ( 1 8 H D U M P O N L O G I C A L 1 3 ) N B X = N R O W / 1 6 N B Y = N C 0 L / 1 6 N B Z = N L E V / 8 I T O T A L = N B X * N B Y * N B Z I P R O D = I T O T A L / N B Z R E W I N D N T A P E W R I T E ( N T A P E ) I T O T A L D O 2 0 1 = 1 , I T O T A L D O 5 0 0 1 1 1 = 1 , 1 6 D O 5 0 0 1 2 2 = 1 , 1 6 D O 5 0 0 1 3 3 = 1 , 8 5 0 0 B ( I 1 1 , I 2 2 , I 3 3 ) = 0 . 0 C F I N D B L O C K C O O R D I N A T E S K B L K = ( ( 1 - 1 ) / I P R O D ) + l N P L A C E = I - ( K B L K - 1 ) * I P R O D J B L K = ( ( N P L A C E - 1 ) / N B X ) + l I B L K = N P L A C E - ( J B L K - 1 ) * N B X C F I N D G R I D C O O R D I N A T E S I S = ( I B L K - 1 ) * 1 6 + 1 I E = I S + 1 5 J S = ( J B L K - 1 ) * 1 6 + 1 J E = J S + 1 5 K S = ( K B L K - 1 ) * 8 + l K E = K S + 7 C W R I T E ( 6 , 3 2 7 ) I S , I E , J S , J E , K S , K E C 3 2 7 F 0 R M A T ( 6 I 1 0 ) 4 2 9 D O 9 3 K I = 1 , N U M B I F I K E . L T . B O T ( K I ) . O R . K S . G T . T O P ( K I ) ) G O T O 9 3 K K = U N R L ( K I ) K B O T = K S I F ( B O T ( K I ) . G T . K S ) K B O T = B O T ( K I ) K T O P = K E I F ( T O P ( K I ) . L T . K E ) K T O P = T 0 P ( K I ) 9 4 D O 1 9 I I Q = I S , I E I B = I I Q « ( I B L K - 1 ) * 1 6 C A L L B O U N D ( K K , I 1 0 , J S , J E ) DO 5 0 K = K B O T , K T O P K B = K — ( K B L K - 1 ) * 8 DO 5 0 J O = J S , J E J B = J Q - ( J B L K - 1 ) * 1 6 Z Q U A = 0 . 0 I F ( L I N E ( J Q ) . N E . 0 ) Z Q U A = - Q U A L ( L I N E ( J Q ) ) 5 0 B ( I B , J B , K B ) = Z Q U A 1 9 C O N T I N U E 9 3 C O N T I N U E 4 2 7 W R I T E ( N T A P E ) B I F ( I . E Q . 2 3 ) W R I T E ( 6 , 5 5 5 ) B 5 5 5 F O R M A T ( ' » , 1 6 F 6 . 3 ) 2 0 C O N T I N U E R E W I N D N T A P E C A L L C L O C K R E T U R N E N D S U B R O U T I N E B O U N D ( N L E V , N R O W , I S , I E ) I N T E G E R V A L ( 1 0 ) , H E A D L ( 2 0 ) , H E A D R ( 5 0 0 , 3 ) , I N F O ( 6 0 0 0 ) , P O I N T 175 I N T E G E R I E N D ( 1 0 ) , I S T A R T ( 1 0 ) C O M M O N I P L A C E , I S T A R T , I E N D , V A L , H E A D L , H E A D R , I N F O , I I N F O * , I H E A D R , P O I N T C O M M O N / L / L I N E ( 2 5 0 ) DO 1 1 = 1 , 2 5 0 1 L I N E ( I ) =0 I N D E X = H E A D L ( N L E V ) 2 I F ( I N D E X . E Q . O ) R E T U R N I F ( H E A D R ( I N D E X , 1 ) ~ N R O W ) 3 , 4 , 5 4 I I I = H E A D R ( I N D E X , 2 ) 6 I F ( I I I . E Q . O ) R E T U R N C A L L U N P A C K ( I S T , I E N , I I V A , 1 0 I N T , I N F O ( I I I ) ) I F ( 1 S T . G T . I E . O R . I E N . L T . I S ) G O T O 8 I F ( I S T . L T . I S ) I S T = I S I F ( I E N . G T . I E ) I E N = I E D O 7 I = I S T , I E N 7 L I N E ( I ) = 1 I V A 8 1 1 1 = 10 I N T G O T O 6 3 I N D E X = H E A D R ( I N D E X , 3 ) GO T O 2 5 R E T U R N E N D S U B R O U T I N E C L O C K L O G I C A L S T A R T D A T A S T A R T / . F A L S E . / I F ( S T A R T ) G O T O 1 B E G I N = S C L O C K ( 0 . 0 ) S T A R T = . T R U E . T L A S T = 0 . 0 1 T = S C L O C K ( B E G I N ) / 6 0 . 0 E T I M = T - T L A S T T L A S T =T W R I T E ( 6 , 2 ) T , E T I M 2 F O R M A T ( * T O T A L T I M E U S E D = ' , F 8 . 3 , ' I N C R E M E N T = » , F 8 . 3 ) R E T U R N E N D 176 Appendix C. NEW RELAXATION ITERATION ROUTINES Changes were made in the re laxat ion program to allow the sequence that the blocks are i te ra ted to be e i t h e r forward or backward and to allow the i t e ra t ions over the physica l work area to be e i t h e r forward or backward. In a d d i t i o n , the routine RLX3D was rewrit ten in assembly language to increase the speed. The increase in speed achieved was about a fac tor of 12. L i s t i n g s of the new routines MAINB and RLX3D are given on the fo l lowing pages. These are compatible with the program as d i s t r i b u t e d by N e l s o n . 1 L f 177 S U B R O U T I N E M A I N B ( A , I D , J D , K D , I D I R , J D I R , * ) C O M M O N / C O R S I Z / I Z , J Z , K Z , I H , J H , K H D I M E N S I O N A( I D , J D , K D ) C O M M O N / T A U / T I M E C O M M O N / S S W / S S 2 , S S 3 , S S 4 L O G I C A L S S 2 , S S 3 , S S 4 C O M M O N / C A R D / P I , P 2 , P 3 , P 4 , P 5 , P 6 , P 7 , P 8 C O M M O N / B C / E P ( 6 ) D I M E N S I O N E Q ( 6 ) C O M M O N / P S A / L X , L Y , L Z , P ( 2 2 ) C O M M O N / V O L U M E / N X , N Y , N Z , N B K X , N B K Y , N B K Z , L X S , L Y S , L Z S , I D E L , J D E L , K D X D E L C A L L D A T A ( & 9 9 9 ) I F ( I D I R . E Q . D G O T O 2 0 1 I F ( I D I R . E Q . - 1 ) G 0 T O 2 0 2 P R I N T 2 0 3 2 0 3 F O R M A T ( 1 U N D E F I N E D I T E R A T I O N D I R E C T I O N I D I R = 1 A S S U M E D 1 ) I D I R = 1 G O T O 2 0 1 2 0 2 L X S = M A X 1 ( ( P 1 + P 2 - 2 . ) , 1 . ) N B L K X = P 2 L Y S = M A X 1 ( ( P 3 + P 4 - 2 . ) , 1 . ) N B L K Y = P 4 L Z S = M A X 1 ( ( P 5 + P 6 - 2 . ) , 1 . ) N B L K Z = P 6 I D E L = - 1 J D E L = - 1 K D E L = Q , 1 L 0 0 P X = P 1 L 0 0 P Y = P 3 L 0 0 P Z = P 5 G O T O 2 0 5 2 0 1 L X S = P 1 N B L K X = P 2 L Y S = P 3 N B L K Y = P 4 L Z S = P 5 N B L K Z = P 6 I D E L = 1 J D E L = 1 KDEL=1 L 0 0 P X = N B L K X - 1 L 0 0 P Y = N B L K Y - 1 L 0 0 P Z = N B L K Z - 1 2 0 5 N = P 7 I F U D I R . E Q . - l ) N = - N C = P 8 K = l P R I N T 1 , K , N , C 1 F O R M A T ( 1 0 H I T E R A T E 2 I 6 , F 1 0 . 5 ) 5 L Z = L Z S 1 0 L Y = L Y S 2 0 L X = L X S 3 0 C A L L L O D A ( L X , L Y , L Z , A , I D , J D , K D , G 9 9 9 ) D O 3 1 1 = 1 , 6 3 1 E Q ( I ) = 1 . I F ( L X . E Q . l ) E Q ( 1 ) = E P ( 1 ) I F ( L Y . E Q . l ) E Q ( 3 ) = E P ( 3 ) I F ( L Z . E Q . l ) E Q ( 5 ) = E P ( 5 ) - 178 I F ( L X . G E . N B K X - l ) E Q ( 2 ) = E P ( 2 ) I F ( L Y . G E . N B K Y - 1 ) E Q ( 4 ) = E P ( 4 ) I F ( L Z . G E . N B K Z - 1 ) E Q ( 6 ) = E P ( 6 ) C A L L C L O C K { £ 9 9 9 ) P R I N T 1 0 0 C I F ( S S 3 ) P R I N T 1 0 0 1 0 0 F O R M A T ( 1 2 H R E L A X A T I O N ) R = 0 . RN = 0 . L = ( N B K X - 1 ) * ( ( N B K Y - 1 ) * ( L Z - 1 ) + L Y - 1 ) + L X C A L L R L X 3 D ( A , I Z , J Z t K Z . l t 1 , I t M I N O ( N X - I H * . ( L X - 1 ) , I Z ) t M I N O ( N Y - J H * ( L Y - l X ) t J Z ) t M I N O ( N Z - K H * ( L Z - 1 ) t K Z ) t C t 1 1 N t R t R N t E Q ) P R I N T 1 0 1 , R t R N C I F ( S S 3 ) P R I N T l O l t R t R N 1 0 1 F O R M A T ( 1 2 H R E S I D U E = , 2 E 1 4 . 5 ) I F ( I D I R . E Q . l ) G 0 T O 2 1 4 L X = L X + I D E L I F ( L X . G E . L O O P X ) G O T O 3 0 L Y = L Y + J D E L I F ( L Y . G E . L O O P Y ) G O T O 2 0 L Z = L Z + K D E L I F ( L Z . G E . L O O P Z ) G O T O 1 0 GO T O 2 1 1 2 1 4 L X = L X + I D E L I F ( L X . L E . L O O P X ) GO T O 3 0 L Y = L Y + J D E L I F ( L Y . L E . L O O P Y ) GO T O 2 0 L Z = L Z + K D E L I F ( L Z . L E . L O O P Z ) GO T O 1 0 2 1 1 K = K - 1 I F ( K . G T . 0 ) G O T O 5 L X = L X S L Y = L Y S L Z = L Z S C A L L C L 0 C K ( & 9 9 9 ) 8 0 0 C A L L U N L O A D R E T U R N 9 9 9 R E T U R N 1 E N D 179 M A C R O B O T & L A B E L L E L T E R B M A R L E L P E R L E L P E R A U R L E L P E R A U R L E L P E R A U R A R L E L P E R A U R A U R S R D E L E S U R M E A U R L P E R S T E S R M E N D M A C R O T O P & L A B E L L E L T E R B M A R L E L P E R L E L P E R A U R L E L P E R A U R L E L P E R A U R S R L E L P E R A U R A U R A R D E L E S U R M E G D I , £ D 2 » 6 D 3 , & D 4 , & L A B E L 0 , 1 2 8 ( 1 , 5 ) 0 , 0 * + 7 4 1 , 5 0 , & D 1 . ( 1 ) 2 , 0 0 , & D 2 . ( 1 ) 0 , 0 2 , 0 0 , f i D 3 . ( l ) 0 , 0 2 , 0 0 , & D 4 . ( 1 ) 0 , 0 2 , 0 1 , 8 0 , 1 2 8 ( 1 ) 0 , 0 2 , 0 2 , 0 1 , 8 2 , = E ' 6 ' 0 , 1 2 8 ( 1 ) 2 , 0 2 , 7 2 ( 0 , 1 4 ) 0 , 2 0 , 0 0 , 1 2 8 ( 1 ) 1 , 5 & D 1 , & D 2 , £ D 3 , S D 4 , c ; L A B E L 0 , 1 2 8 ( 1 , 5 ) 0 , 0 * + 7 4 1 , 5 0 , S D 1 . ( 1 ) 2 , 0 0,£D2 . ( 1 ) 0 , 0 2 , 0 0 , & D 3 . ( 1 ) 0 , 0 2 , 0 0 , £ D 4 . ( 1 ) 0 , 0 2 , 0 1 , 8 0 , 1 2 8 ( 1 ) 0 , 0 2 , 0 2 , 0 1 , 8 2 , = E ' 6 » 0 , 1 2 8 ( 1 ) 2 , 0 2 , 7 2 ( 0 , 1 4 ) A U R 0 , 2 L P E R 0 , 0 S T E 0 , 1 2 8 ( 1 ) S R 1 , 5 M E N D M A C R O I N T £ D 1 , £ D 2 , £ D 3 , £ D 4 , £ L A B E L £ L A B E L L E 0 , 1 2 8 ( 1 , 5 ) L T E R 0 , 0 BM * + 8 4 A R 1 , 5 L E 0 , £ D 1 . ( 1 ) L P E R 2 , 0 L E 0 , £ D 2 . ( 1 ) L P E R 0 , 0 A U R 2 , 0 L E 0 , £ D 3 . ( 1 ) L P E R 0 , 0 A U R 2 , 0 L E 0 , £ D 4 . ( 1 ) L P E R 0 , 0 A U R 2 , 0 A R 1 , 8 L E 0 , 1 2 8 ( 1 ) L P E R 0 , 0 A U R 2 , 0 S R 1 , 8 S R 1 , 8 L E 0 , 1 2 8 ( 1 ) L P E R 0 , 0 A U R 2 , 0 A R 1 , 8 D E 2 , = E ' 6 ' L E 0 , 1 2 8 ( 1 ) S U R 2 , 0 M E 2 , 7 2 ( 0 , 1 4 ) A U R 0 , 2 L P E R 0 , 0 S T E 0 , 1 2 8 ( 1 ) S R 1 , 5 M E N D M A C R O S Y M £ D , £ B R A N C H L 1 0 , 7 6 ( 0 , 1 4 ) L E 0 , £ 0 . ( 1 0 ) L T E R 0 , 0 B N Z £ B R A N C H M E N D T I T L E ' R L X 3 D V E R S I O N 4 ' R L X C S E C T E N T R Y R L X 3 D U S I N G * , 1 2 R L X 3 D S T M 1 4 , 1 2 , 1 2 ( 1 3 ) L R 1 2 , 1 5 S T 1 3 , A S A V E * * * * * * * * * R 1 C O N T A I N S A D D R E S S O F F I R S T C A L L I N G P A R A M E T E R * * * * * * * * « S E T U P L O O P S F O R 3 2 B Y 3 2 B Y 1 6 A R R A Y * * * * S * * * * C A L L R L X 3 D ( A , I Z , J Z , K Z , 1 , 1 , 1 , I L , J L , K L , C , 1 , N , R , R N , E Q ) * * * * * * * * * 0 4 8 1 2 1 6 2 0 2 4 2 8 3 2 3 6 4 0 4 4 4 8 5 2 5 6 6 0 1:81 R E G I S T E R U S E * G E N E R A L 0 N U M B E R O F I T E R A T I O N S * 1 I *T* 2 I I N C R E M E N T ( 4 ) 3 I L I M I T 4 K 5 J ' r 6 J I N C R E M E N T ( 1 2 8 ) * r 7 J L I M I T 8 K I N C R E M E N T ( 4 0 9 6 ) 9 K L I M I T 1 0 1 1 - r 1 2 B A S E R E G I S T E R 1 3 "»* 1 4 - i - 1 5 F L O A T I N G P O I N T * 0 * 2 4 S U M O F A L L R E S I D U E S 6 S U M O F N E G A T I V E R E S I D U E S ^ vl, o-T> -1^  ^ -V ^ O- „t„ . 1 , f* i" V I N O R D E R S U B T R A C T T O H A V E A L L 1 2 8 F R O M A A D I S P L A C M E N T S P O S I T I V E A N D A D D 1 2 8 T O D I S P L A C M E N T S L 1 4 , = V ( R E G S ) L 2 , = F ' 4 ' S T 2 , 4 ( 0 , 1 4 ) L NR 2 , 2 S T 2 , 4 0 ( 0 , 1 4 ) L 2 » = F ' 1 2 8 • S T 2 , 2 0 ( 0 , 1 4 ) L N R 2 , 2 S T 2 , 5 6 ( 0 , 1 4 ) L 2 , = F » 4 0 9 6 « S T 2 , 2 8 ( 0 , 1 4 ) L N R 2 , 2 S T 2 , 6 4 ( 0 , 1 4 ) S T 1 , A L 1 S T L 9 , 0 ( 0 , 1 ) S 9 t = F 1 1 2 8 ' S T 9 , A A L 1 0 , 2 8 ( 0 , 1 ) L 1 1 , 0 ( 0 , 1 0 ) S 1 1 , = F ' 2 ' M 1 0 , = F ' 4 ' S T 1 1 , 8 ( 0 , 1 4 ) A 1 1 , = F ' 4 ' S T 1 1 , 3 6 ( 0 , 1 4 ) L 1 0 , 1 6 ( 0 , 1 ) L 1 1 , 0 ( 0 , 1 0 ) S 1 1 , = F • 1 • M 1 0 , = F ' 4 ' S T 1 1 , 0 ( 0 , 1 4 ) S T 1 1 , 4 4 ( 0 , 1 4 ) L 1 0 , 3 2 ( 0 , 1 ) L 1 1 , 0 ( 0 , 1 0 ) L O A D A D D R E S S O F A A D D R E S S O F A - 1 2 8 A ( A ) - 1 2 8 = C ( A A ) A D D R E S S O F I Z L O A D I Z C A L C I L I M I T A D D R E S S O F J Z L O A D J Z 182 S 11,=F'2' CALC J LIMIT M 10,=F'128« ST 1 1 , 2 4 ( 0 , 1 4 ) A 11,=F'128' ST 1 1 , 5 2 ( 0 , 1 4 ) L 1 0 , 2 0 ( 0 , 1 ) L 1 1 , 0 ( 0 , 1 0 ) S l l , = F ' l ' M 10,=F'128« ST 1 1 , 1 6 ( 0 , 1 4 ) ST 1 1 , 6 0 ( 0 , 1 4 ) L 1 0 , 3 6 ( 0 , 1 ) ADDRESS OF KZ L 1 1 , 0 ( 0 , 1 0 ) LOAD KZ S 11 ,=F '2' CALC K LIMIT M 10,=F'4096' A 11,AA ST 1 1 , 3 2 ( 0 , 1 4 ) A 11,=F'4096' ST 1 1 , 4 8 ( 0 , 1 4 ) L 1 0 , 2 4 ( 0 , 1 ) L 1 1 , 0 ( 0 , 1 0 ) S 11,=F • 1 • M 10,=F'4096' A 11,AA ST 1 1 , 1 2 ( 0 , 1 4 ) ST 1 1 , 6 8 ( 0 , 1 4 ) L 1 0 , 4 8 ( 0 , 1 ) LOAD ADDRESS OF N L 0 , 0 ( 0 , 1 0 ) LOAD N L 9,=F'1« LTR 0,0 DETERMINE STARTING ITERATION DIRECTION BP ST LPR 0,0 L NR 9,9 ST 9,IDIR L 1 0 , 4 0 ( 0 , 1 ) LOAD ADDRESS OF C LE 0 , 0 ( 0 , 1 0 ) LOAD C STE 0 , 7 2 ( 0 , 1 4 ) STORE C L 1 0 , 5 2 ( 0 , 1 ) , LOAD ADDRESS OF R LE 4 , 0 ( 0 , 1 0 ) LOAD R L 1 0 , 5 6 ( 0 , 1 ) LOAD ADDRESS OF RN LE 6 , 0 ( 0 , 1 0 ) LOAD RN L 1 0 , 6 0 ( 0 , 1 ) LOAD ADDRESS OF EQ ST 1 0 , 7 6 ( 0 , 1 4 ) STORE ADDRESS OF EQ LA 14,SAVEAR ADDRESS OF SAVE AREA ST 1 4 , 8 ( 0 , 1 3 ) SET FORWARD POINTER ST 1 3 , 4 ( 0 , 1 4 ) SET BACKWARD POINTER LR 13,14 •START ITERATION LOOP L 14,IDIR LT R 14,14 BP FWD L 15,=V(RLXBWD) B SWTCH L 15,=V(RLXFWD ) L NR 14,14 ST 14,IDIR BAL R 14,15 BC T 0,ITER • ITERATIONS F I N I SHED,SAVE REQUIRED VALUES L 1,ALIST LOAD ADDRESS OF LIST 1'83 L 1 0 , 5 2 ( 0 , 1 ) A D D R E S S OF RS S T E 4 , 0 ( 0 , 1 0 ) S T O R E RS L 1 0 , 5 6 ( 0 , 1 ) A D D R E S S OF RN S T E 6 , 0 ( 0 , 1 0 ) S T O R E RN -r- - r - * r i - f* **r* T* * * R E S T O R E R E G I S T E R S AND R E T U R N L 1 3 , A S A V E LM 1 4 , 1 2 , 1 2 ( 13 ) SR 1 5 , 1 5 BCR 1 5 , 1 4 A S A VE DS A I D I R DS F AA DS A A L I ST DS F S A V E A R DS 1 8 F L T O R G R E G S COM DS 2 0 F END RL XF C S E C T E N T R Y RL XFWD US I N G * , 1 2 RL XF WD STM 1 4 , 1 2 , 1 2 ( 13 ) LR 1 2 , 1 5 S T 1 3 , A S A V E L 1 4 , = V ( R E G S ) LM 1 , 9 , 0 ( 1 4 ) 2|£ 5j> * * S T A R T L O O P OVER K 5ji SjC SjC 3(C 5jC 2^ ?|t * * D O B O T T E M P L A N E SYM 1 6 , I N S I D E L R 5 , 4 S E T J TO C U R R E N T L R 7 , 5 S E T J L I M I T A 7 , 2 4 ( 0 , 1 4 ) L 1 , 0 ( 0 , 1 4 ) S E T I SYM 0 , L Q 1 BOT 1 3 2 , 1 3 2 , 2 5 6 , 2 5 6 C O R N E R LQ1 AR 1 , 2 I N C R E M E N T I SYM 8 , L Q 2 I L 0 0 P 1 BOT 1 3 2 , 1 2 4 , 2 5 6 , 2 5 6 , I L 0 0 P 1 6 X L E 1 , 2 , I L 0 0 P 1 L Q 2 NOPR 14 SYM 4 , L L I BOT 1 2 4 , 1 2 4 , 2 5 6 , 2 5 6 C O R N E R L L I AR 5 , 6 I N C R E M E N T J J L O O P 1 L 1 , 0 ( 0 , 1 4 ) S E T I SYM 0 , L L 2 BOT 1 3 2 , 1 3 2 , 0 , 2 5 6 L L 2 AR 1 , 2 I N C R E M E N T I * r V ' t 5 * * D O I N T E R I O R P O I N T S IN B O T T E M P L A N E I L O O P 2 L E 0 , 1 2 8 ( 1 , 5 ) L T E R 0 , 0 BM SK I P L E 0 , 1 3 2 ( 1 , 5 ) L P E R 2 , 0 L E 0 , 1 2 4 ( 1 , 5 ) L P E R 0 , 0 AUR 2 , 0 L E 0 , 2 5 6 ( 1 , 5 ) L PER 0 , 0 AUR 2 , 0 L E 0 , 0 ( 1 , 5 ) 1,84 L P E R 0 , 0 A U R 2 , 0 A R 1 , 8 L E 0 , 1 2 8 ( 1 , 5 ) L P E R 0 , 0 A U R 2 , 0 A U R 2 , 0 S R 1 , 8 D E 2 , = E ' 6 « L E 0 , 1 2 8 ( 1 , 5 ) S U R 2 , 0 B P P Q S A U R 6 , 2 S U R 4 , 2 M E 2 , 7 2 ( 0 , 1 4 ) A U R 0 , 2 L P E R 0 , 0 S T E 0 , 1 2 8 ( 1 , 5 ) B S K I P A U R 4 , 2 M E 2 , 7 2 ( 0 , 1 4 ) A U R 0 , 2 S T E 0 , 1 2 8 ( 1 , 5 ) B X L E l , 2 , I L O O P 2 S Y M 4 , L Q 3 B O T 1 2 4 , 1 2 4 , 0 , 2 5 6 E D G E B X L E 5 , 6 , J L 0 0 P 1 L 1 , 0 ( 0 , 1 4 ) S E T X I N D E X S Y M 0 , L Q 4 B O T 1 3 2 , 1 3 2 , 0 , 0 C O R N E R A R 1 , 2 I N C R E M E N T I S Y M 1 2 , L Q 5 B O T 1 2 4 , 1 3 2 , 0 , 0 , I L 0 0 P 3 B X L E l , 2 , I L O O P 3 N O P R 1 4 S Y M 4 , I N S I D E B O T 1 2 4 , 1 2 4 , 0 , 0 C O R N E R * B O T T EM P L A N E D O N E A R 4 , 8 I N C R E M E N T K L R 5 , 4 R E S E T Y I N D E X L R 7 , 5 S E T J L I M I T A 7 , 2 4 ( 0 , 1 4 ) L 1 , 0 ( 0 , 1 4 ) R E S E T X I N D E X S Y M 0 , L L 3 I N T 1 3 2 , 1 3 2 , 2 5 6 , 2 5 6 A R 1 , 2 I N C R E M E N T X S Y M 8 , L L 1 3 I N T 1 3 2 , 1 2 4 , 2 5 6 , 2 5 6 , I L 0 0 P 4 B X L E 1 , 2 , I L 0 0 P 4 N O P R 1 4 S Y M 4 , N E X T I N T 1 2 4 , 1 2 4 , 2 5 6 , 2 5 6 A R 5 , 6 I N C R E M E N T J L 1 , 0 ( 0 , 1 4 ) R E S E T X I N D E X S Y M 0 , N E X U I N T 1 3 2 , 1 3 2 , 0 , 2 5 6 E D G E A R 1 , 2 I N C R E M E N T I ^ I N T E R I O R P O I N T S O F I N T E R I O R P L A N E S L E 0 , 1 2 8 ( 1 , 5 ) L T E R 0 , 0 BM S K J P L E 0 , 1 3 2 ( 1 , 5 ) L P E R 2 , 0 L E 0 , 1 2 4 ( 1 , 5 ) L P E R 0 , 0 A U R 2 , 0 L E 0 , 2 5 6 ( 1 , 5 ) L P E R 0 , 0 A U R 2 , 0 L E 0 , 0 ( 1 , 5 ) L P E R 0 , 0 A U R 2 , 0 A R 1 , 8 L E 0 , 1 2 8 ( 1 , 5 ) L P E R 0 , 0 A U R 2 , 0 S R 1 , 8 S R 1 , 8 L E 0 , 1 2 8 ( 1 , 5 ) L P E R 0 , 0 A U R 2 , 0 A R 1 , 8 D E 2 , = E ' 6 ' L E 0 , 1 2 8 ( 1 , 5 ) S U R 2 , 0 B P P O Z A U R 6 , 2 S U R 4 , 2 ME 2 , 7 2 ( 0 , 1 4 ) A U R 0 , 2 L P E R 0 , 0 S T E 0 , 1 2 8 ( 1 , 5 ) B S K J P A U R 4 , 2 M E 2 , 7 2 ( 0 , 1 4 ) A U R 0 , 2 S T E 0 , 1 2 8 ( 1 , 5 ) B X L E 1 , 2 , I L 0 0 P 8 S Y M 4 , N E X V I N T 1 2 4 , 1 2 4 , 0 , 2 5 6 6 X L E 5 , 6 , J L 0 0 P 3 L 1 , 0 ( 0 , 1 4 ) R E S E T I S Y M 0 , L L 1 2 I N T 1 3 2 , 1 3 2 , 0 , 0 A R 1 , 2 I N C R E M E N T S Y M 1 2 , L L 1 4 I N T 1 2 4 , 1 3 2 , 0 , 0 , I L 0 0 P 6 B X L E 1 , 2 , I L 0 0 P 6 N O P R 1 4 S Y M 4 , N E X S I N T 1 2 4 , 1 2 4 , 0 , 0 B X L E 4 , 8 , K L 0 0 P 1 ^ I N T E R I O R P L A N E S D O N E D O T O P P L A N E S Y M 2 0 , F I N L 1 , 0 ( 0 , 1 4 ) R E S E T I L R 5 , 4 R E S E T J L R 7 , 5 A 7 , 2 4 ( 0 , 1 4 ) S Y M 0 , L 0 1 0 T O P 1 3 2 , 1 3 2 , 2 5 6 , 2 5 6 C O R N E R L Q 1 0 AR 1 ,2 INCREMENT SYM 8 , L Q 1 1 I L O O P 7 TOP 1 3 2 , 1 2 4 , 2 5 6 , 2 5 6 , I L 0 0 P 7 B X L E 1 ,2 , I L O O P 7 L Q 1 1 NOPR 1 4 SYM 4 , L L 4 TOP 1 2 4 , 1 2 4 , 2 5 6 , 2 5 6 CORNER L L 4 AR 5,6 J L O O P 4 L 1 , 0 ( 0 , 1 4 ) R E S E T I SYM 0 , L L 5 TOP 1 3 2 , 1 3 2 , 0 , 2 5 6 EDGE L L 5 AR 1,2 INCREMENT x'^  >A* V.* O** **DO I N T E R I O R P O I N T S IN TOP P L A N E I L O O P X LE 0 , 1 2 8 ( 1 , 5 ) L T E R 0,0 BM SK K P L E 0 , 1 3 2 ( 1 , 5 ) L P E R 2,0 L E 0 , 1 2 4 ( 1 ,5 ) L P E R 0,0 AUR 2,0 LE 0 , 2 5 6 ( 1 , 5 ) L P E R 0,0 AUR 2,0 L E 0 , 0 ( 1 , 5 ) L P E R 0,0 AUR 2,0 SR 1,8 L E 0 , 1 2 8 ( 1 , 5 ) L P E R 0,0 AUR 2,0 AUR 2,0 AR 1 ,8 DE 2,=E ' 6 ' LE 0 , 1 2 8 ( 1 ,5 ) SUR 2,0 BP POR AUR 6,2 SUR 4,2 ME 2 , 7 2 ( 0 , 1 4 ) AUR 0,2 L P E R 0,0 STE 0 , 1 2 8 ( 1 , 5 ) B S K K P POR AUR 4,2 ME 2 , 7 2 ( 0 , 1 4 ) AUR 0,2 STE 0 , 1 2 8 ( 1 , 5 ) S K K P B X L E 1 , 2 , I L O O P X SYM 4 , L L 6 TOP 1 2 4 , 1 2 4 , 0 , 2 5 6 L L 6 B X L E 5 , 6 , J L 0 0 P 4 L 1 , 0 ( 0 , 1 4 ) SET I SYM 0 , L Q 1 2 TOP 1 3 2 , 1 3 2 , 0 , 0 L Q 1 2 AR 1,2 INCREMENT SYM 1 2 , L 0 1 3 I L 0 0 P 9 TOP 1 2 4 , 1 3 2 , 0 , 0 , I L 0 0 P 9 B X L E 1 , 2 , I L 0 0 P 9 L Q 1 3 NOPR 1 4 S Y M 4 , F I N T O P 1 2 4 , 1 2 4 , 0 , 0 «.C ,1, si , ^ U . '(- 't- -v> 'r T -c * T O P P L A N E D O N E F I N L 1 3 , A S A V E L M 1 4 , 1 2 , 1 2 ( 1 3 ) S R 1 5 , 1 5 B C R 1 5 , 1 4 A S A V E D S A L T O R G R E G S C O M D S 2 0 F E N D R L X B C S E C T E N T R Y R L X B W D U S I N G * t l 2 R L X B W D S T M 1 4 , 1 2 , 1 2 ( 1 3 ) L R 1 2 , 1 5 S T 1 3 , A S A V E L 1 4 , = V ( R E G S ) L M 1 , 9 , 3 6 ( 1 4 ) J|C £|iC 3JC J^c 3[C * S T A R T L O O P O V E R K J Q P P L A N E S Y M 2 0 , I N S I D E L R 5 , 4 L R 7 , 5 A 5 , 5 2 ( 0 , 1 4 ) L 1 , 3 6 ( 0 , 1 4 ) S Y M 4 , L Q l B O T 0 , 0 , 1 2 4 , 1 2 4 L Q l A R 1 , 2 S Y M 1 2 , L Q 2 I L 0 0 P 1 B O T 1 3 2 , 1 2 4 , 0 , 0 , B X H 1 , 2 , I L 0 0 P 1 L Q 2 N O P R 1 4 S Y M 0 , L L 1 B O T 0 , 0 , 1 3 2 , 1 3 2 L L 1 A R 5 , 6 J L Q O P 1 L 1 , 3 6 ( 0 , 1 4 ) S Y M 4 , L L 2 B O T 1 2 4 , 1 2 4 , 0 , 2 5 L L 2 A R 1 , 2 * D O I N T E R I O R P O I N T S I L O O P 2 L E 0 , 1 2 8 ( 1 , 5 ) L T E R 0 , 0 BM S K I P L E 0 , 1 3 2 ( 1 , 5 ) L P E R 2 , 0 L E 0 , 1 2 4 ( 1 , 5 ) L P E R 0 , 0 A U R 2 , 0 L E 0 , 2 5 6 ( 1 , 5 ) L P E R 0 , 0 A U R 2 , 0 L E 0 , 0 ( 1 , 5 ) L P E R 0 , 0 A U R 2 , 0 A R 1 , 8 L E 0 , 1 2 8 ( 1 , 5 ) L P E R 0 , 0 A U R 2 , 0 187 S E T S E T J T O C U R R E N T J L I M I T C O R N E R I N C R E M E N T IN C O R N E R I N C R E M E N T S E T I I N C R E M E N T T O P P L A N E 188 A U R 2 , 0 S R 1 , 8 D E 2 , = E ' 6 • L E 0 , 1 2 8 ( 1 , 5 ) S U R 2 , 0 B P P O S A U R 6 , 2 S U R 4 , 2 M E 2 , 7 2 ( 0 , 1 4 ) A U R 0 , 2 L P E R 0 , 0 S T E 0 , 1 2 8 ( 1 , 5 ) B S K I P P O S A U R 4 , 2 M E 2 , 7 2 ( 0 , 1 4 ) A U R 0 , 2 S T E 0 , 1 2 8 ( 1 , 5 ) S K I P B X H 1 , 2 , I L 0 0 P 2 S Y M 0 , L Q 3 B O T 1 3 2 , 1 3 2 , 0 , 2 5 6 E D G E L Q 3 B X H 5 , 6 , J L 0 0 P 1 L 1 , 3 6 ( 0 , 1 4 ) S Y M 4 , L Q 4 B O T 1 2 4 , 1 2 4 , 2 5 6 , 2 5 6 C O R N E R L Q 4 A R 1 , 2 I N C R E M E N T I S Y M 8 , L Q 5 I L O O P 3 B O T 1 2 4 , 1 3 2 , 2 5 6 , 2 5 6 , I L 0 0 P 3 B X H 1 , 2 t I L 0 0 P 3 L 0 5 N O P R 1 4 S Y M 0 , I N S I D E B O T 2 5 6 , 2 5 6 , 1 3 2 , 1 3 2 iJf ^r **r s 1 * •fy* rf* rf* rf* rf* rf* r^ * * T O P P L A N E D O N E I N S I D E A R 4 , 8 I N C R E M E N T K K L 0 0 P 1 L R 5 , 4 R E S E T Y I N D E X L R 7 , 5 S E T J L I M I T A 5 , 5 2 ( 0 , 1 4 ) L 1 , 3 6 ( 0 , 1 4 ) R E S E T X I N D E X S Y M 4 , L L 3 I N T 1 2 4 , 1 2 4 , 0 , 0 L L 3 A R 1 , 2 I N C R E M E N T X S Y M 1 2 , L L 1 3 I L O O P 4 I N T 1 3 2 , 1 2 4 , 0 , 0 , I L 0 0 P 4 B X H 1 , 2 , I L 0 0 P 4 L L 1 3 N O P R 1 4 S Y M 0 , N E X T I N T 0 , 0 , 1 3 2 , 1 3 2 N E X T A R 5 , 6 I N C R E M E N T J J L 0 0 P 3 L 1 , 3 6 ( 0 , 1 4 ) R E S E T X I N D E X S Y M 4 , N E X U I N T 1 2 4 , 1 2 4 , 0 , 2 5 6 E D G E N E X U A R 1 , 2 I N C R E M E N T I * * * * * * * * * I N T E R I O R P O I N T S O F I N T E R I O R P L A N E S I L O O P 8 L E 0 , 1 2 8 ( 1 , 5 ) L T E R 0 , 0 BM S K J P L E 0 , 1 3 2 ( 1 , 5 ) L P E R 2 , 0 L E 0 , 1 2 4 ( 1 , 5 ) L P E R 0 , 0 A U R 2 , 0 L E 0 , 2 5 6 ( 1 , 5 ) 9 L P E R 0 , 0 A U R 2 , 0 L E 0 , 0 ( 1 , 5 ) L P E R 0 , 0 A U R 2 , 0 A R 1 , 8 L E 0 , 1 2 8 ( 1 , 5 ) L P E R 0 , 0 A U R 2 , 0 S R 1 , 8 S R 1 , 8 L E 0 , 1 2 8 ( i , 5 ) L P E R 0 , 0 A U R 2 , 0 A R 1 , 8 D E 2 , = E « 6 ' L E 0 , 1 2 8 ( 1 , 5 ) S U R 2 , 0 B P P O Z A U R 6 , 2 S U R 4 , 2 ME 2 , 7 2 ( 0 , 1 4 ) A U R 0 , 2 L P E R 0 , 0 S T E 0 , 1 2 8 ( 1 , 5 ) B S K J P A U R 4 , 2 ' ME 2 , 7 2 ( 0 , 1 4 ) A U R 0 , 2 S T E 0 , 1 2 8 ( 1 , 5 ) B X H 1 , 2 , I L 0 0 P 8 S Y M 0 , N E X V I N T 1 3 2 , 1 3 2 , 0 , 2 5 6 B X H 5 , 6 , J L 0 0 P 3 L 1 , 3 6 ( 0 , 1 4 ) S Y M 4 , L L 1 2 I N T 1 2 4 , 1 2 4 , 2 5 6 , 2 5 6 A R 1 , 2 S Y M 8 , L L 1 4 I N T 1 2 4 , 1 3 2 , 2 5 6 , 2 5 6 , I L 0 0 P 6 B X H 1 , 2 , I L 0 0 P 6 N O P R 1 4 S Y M 0 , N E X S I N T 2 5 6 , 2 5 6 , 1 3 2 , 1 3 2 B X H 4 , 8 , K L 0 0 P 1 • I N T E R I O R P L A N E S D O N E D O B O T T E M P L A N E S Y M 1 6 , F I N R E S E T I I N C R E M E N T I L 1 , 3 6 ( 0 , 1 4 ) L R 5 , 4 L R 7 , 5 A 5 , 5 2 ( 0 , 1 4 ) S Y M 4 , L Q 1 0 T O P 1 2 4 , 1 2 4 , 0 , 0 A R 1 , 2 S Y M 1 2 , L 0 1 1 T O P 1 3 2 , 1 2 4 , 0 , 0 , I L 0 0 P 7 B X H 1 , 2 , I L 0 0 P 7 N O P R 1 4 S Y M 0 , L L 4 R E S E T I R E S E T J C O R N E R I N C R E M E N T I 1,90 T O P 1 3 2 , 1 3 2 , 0 , 0 A R 5 , 6 L 1 , 3 6 ( 0 , 1 4 ) R E S E T I S Y M 4 , L L 5 T O P 1 2 4 , 1 2 4 , 0 , 2 5 6 E D G E A R 1 , 2 I N C R E M E N T * * D 0 I N T E R I O R P O I N T S I N B O T T E M P L A N E L E 0 , 1 2 8 ( 1 , 5 ) L T E R 0 , 0 6M S K K P L E 0 , 1 3 2 ( 1 , 5 ) L P E R 2 , 0 L E 0 , 1 2 4 ( 1 , 5 ) L P E R 0 , 0 A U R 2 , 0 L E 0 , 2 5 6 ( 1 , 5 ) L P E R 0 , 0 A U R 2 , 0 L E 0 , 0 ( 1 , 5 ) L P E R 0 , 0 A U R 2 , 0 S R 1 , 8 L E 0 , 1 2 8 ( 1 , 5 ) L P E R 0 , 0 A U R 2 , 0 A U R 2 , 0 A R 1 , 8 D E 2 , = E ' 6 « L E 0 , 1 2 8 ( 1 , 5 ) S U R 2 , 0 B P P O R A U R 6 , 2 S U R 4 , 2 M E 2 , 7 2 ( 0 , 1 4 ) A U R 0 , 2 L P E R 0 , 0 S T E 0 , 1 2 8 ( 1 , 5 ) B S K K P A U R 4 , 2 ME 2 , 7 2 ( 0 , 1 4 ) A U R 0 , 2 S T E 0 , 1 2 8 ( 1 , 5 ) B X H 1 , 2 , I L 0 0 P X S Y M 0 , L L 6 T O P 1 3 2 , 1 3 2 , 0 , 2 5 6 B X H 5 , 6 , J L 0 0 P 4 L 1 , 3 6 ( 0 , 1 4 ) S E T I S Y M 4 , L Q 1 2 T O P 1 2 4 , 1 2 4 , 2 5 6 , 2 5 6 A R 1 , 2 I N C R E M E N T S Y M 8 , L Q 1 3 T O P 1 2 4 , 1 3 2 , 2 5 6 , 2 5 6 , I L 0 0 P 9 B X H 1 , 2 , I L 0 0 P 9 N O P R 1 4 S Y M 0 , F I N T O P 2 5 6 , 2 5 6 , 1 3 2 , 1 3 2 * * B O T T E M P L A N E D O N E L 1 3 , A S A V E L M 1 4 , 1 2 , 1 2 ( 1 3 ) S R 1 5 , 1 5 ASAVE REGS BC R 1 5 , DS A LTORG COM DS 20F END 192 Appendix D. PROGRAM AXCENT. T h i s program p e r f o r m s the a x i a l a c c e p t a n c e c a l c u l a t i o n s d e s c r i b e d i n S e c t i o n 3- The d a t a i n p u t c o n s i s t s o f a d e s c r i p t i o n o f the beam ( e m i t t a n c e and energy) f o l l o w e d by d a t a d e s c r i b i n g a sequence o f f o c u s i n g e l ements (dee gaps o r ma g n e t i c f i e l d r e g i o n s ) . The used f o r the ma g n e t i c f i e l d can be e n t e r e d on the d a t a c a r d s o r d e t e r m i n e d by i n t e r -p o l a t i o n from a t a b l e o f v a l u e s . The program t r a c k s p a r t i c l e s w i t h v a r i o u s phases through the f o c u s i n g e lements up t o some maximum ene r g y . When t h e t r a c k i n g i s c o m p l e t e , the program can match the beam t o a s p e c i f i e d and then c a l c u l a t e , f o r . e a c h phase what e l l i p t i c a l e m i t t a n c e shape i s r e q u i r e d a t i n j e c t i o n t o produce a beam matched t o the f i n a l V a r i o u s p l o t s o f i o n t r a j e c t o r i e s and beam e n v e l o p e s a re a v a i l a b l e . D e s c r i p t i o n o f Data f o r AXCENT A l l d a t a i s read i n f r e e format by s u b r o u t i n e DATA. Each c a r d has 8 numeri c f i e l d s ( c o l s 1 t o 40) and an a l p h a n u m e r i c (comment) f i e l d ( c o l s 41 t o 6 0 ) . T r a i l i n g parameters not s p e c i f i e d a r e s e t t o z e r o . F i e l d s a r e s e p a r a t e d by any c h a r a c t e r e x c e p t +, -, ., 1, ... 9, 0. In g e n e r a l , the f i r s t number on each p i e c e o f d a t a i s an index which s p e c i f i e s what o p e r a t i o n i s t o be performed w h i l e the o t h e r f i e l d s c o n t a i n d a t a . 1, P2, P3, P4, P5, P6; I n i t i a l i z e the problem i f P2 J;Q i n i t i a l i z e t r a n s f e r m a t r i x , E and S o n l y (no d a t a r e q u i red) P3 = C = e cos 6 z = a m p l i t u d e o f 3 r d harmonic a m p l i t u d e o f 1st harmonic P4 = phase o f t h i r d harmonic wi'th r e s p e c t t o the fundamental (6) i f P5 4 0 use t a b l e o f phase s l i p s read from l o g i c a l u n i t 1 i f P6 4 0 use t a b l e o f v v a l u e s read from l o g i c a l u n i t 2 193 one d a t a c a r d r e q u i red PI = i n i t i a l e nergy (M V) P2 = e m i t t a n c e i n i n . rrirad. a t energy PI P3 = zmax (2M Pk = 5 D ( e l l i p s e p a r a m a t e r as d e f i n e d by S t e f f e n ) P5 ¥ 0 then t r a c k backwards ( o t h e r w i s e f o r w a r d ) P6 = maximum energy f o r outward t r a c k i f P6 = 0, no maximum i s s e t P7 = i n i t i a l phase o f " z e r o " phase 2 T r a n s f e r t o s u b r o u t i n e TRACK, r e q u i r e s d a t a as f o l l o w s : 1, P2, P 3 t h i n l e n s P2 = peak v o l t a g e a c r o s s gap (MV) P3 = r e d u c t i o n f a c t o r ( s e t t o 1.0 i f not s p e c i f i e d ) 2, P2, P 3 c o n s t a n t v m a g n e t i c f i e l d r e g i o n P2 = v z (not used i f a t a b l e o f v a l u e s i s p r o v i d e d ) P3 = a n g u l a r l e n g t h (degrees) 3 , P2 r e p e a t the p r e v i o u s two elements (which must be d i f f e r e n t i.e.'one t h i n l e n s and an v r e g i o n ) P2 t i m e s k, P2 p r i n t a f t e r each element ( i n i t i a l l y y e s) P2 = 1 yes P2 = 0 no 5, P2, P3, Pk P2 = 1 t u r n p l o t o u t p u t on (must be done b e f o r e s t a r t o f t r a c k i n g ) P3 = # t u r n s / i n c h on X a x i s ( d e f a u l t t o 1.0) Pk ~ .# z i n c h e s / p l o t i n c h on Y a x i s ( d e f a u l t t o 0.5) P2 = 2 t u r n p l o t o u t p u t o f f P3 = 3 ,4 ,5 , . . .9 causes p l o t s t o be produced a c c o r d i n g t o the f o l l o w i n g t a b l e P2 Z l Z2 e n v e l o p e 3 X k X 5 X 6 X X 7 X X 8 X X 9 X X X i f Pk =999 . a l l phases a r e p l o t t e d , o t h e r w i s e phases Pk t o P5 a r e p l o t t e d 6 RETURN t o MAIN 194 3, P2 Transform back to i n i t i a l s t a r t i n g p o i n t , matah to v P2 z = 4, ' P2, P3 Draw el 1 ipses P2 = # z inches per p lo t inch ( t y p i c a l l y 0.1) P3 = # z l radians per p lo t inch ( t y p i c a l l y 0.01) 5 Compute, overlap of current e l l i p s e s 6 Stop 195 C * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * M A I ^ C T H I S P R O G R A M M E C A N P E R F O R M T H E F O L L O W I N G T A S K S : C C ( 1 ) T R A C K P A R T I C L E S A N D P H A S E S P A C E E L L I P S E S T H R O U G H C A S E R I E S O F E L E C T R I C T H I C K L E N S E S A N D M A G N E T I C F I E L D S C W I T H C O N S T A N T F O C U S S I N G P R O P E R T I E S C C ( 2 ) M A T C H A P H A S E S P A C E E L L I P S E T O A S P E C I F I E D M A G N E T I C F I E L D C C ( 3 ) T R A N S F O R M B A C K T H R O U G H A S Y S T E M T O D E T E R M I N E C W H A T I N I T I A L E L L I P S E I S R E Q U I R E D T O P R O D U C E T H E R E Q U I R E D C F I N A L E L L I P S E C C ( 4 ) C A L C U L A T E T H E C O M M O N A R E A B E T W E E N P H A S E S P A C E E L L I P S E S C F O R D I F F E R E N T P H A S E S C C ( 5 ) D R A W P H A S E S P A C E E L L I P S E S O N A C A L C O M P P L O T T E R C C ( 6 ) P L O T T R A J E C T O R I E S A N D E N V E L O P E S O N A C A L C O M P P L O T T E R C C C - T H I S R O U T I N E R E A D S D A T A A N D T R A N S F E R S C C O N T R O L T O T H E S U B R O U T I N E S . C - T R A N S F E R I S C O N T R O L L E D B Y T H E F I R S T C N U M B E R ON T H E D A T A C A R D . C - A L L D A T A I S R E A D I N F R E E F O R M A T B Y C S U B R O U T I N E " D A T A " A N D T R A N S M I T T E D T H R O U G H C C O M M O N A R E A " C A R D " . C O M M O N / C A R D / P I 8 ) , M N T ( 5 ) C O M M O N / P L T / I S , P R N T C O M M O N / S T A R T / E S T A R T , Z l ( 1 3 ) , Z 1 P ( 1 3 ) , Z 2 ( 1 3 ) , Z 2 P ( 1 3 ) , E P S , E M A X C O M M O N / S T A R T 2 / F I O , D E L T A , C , T H T A C O M M O N / S L I P / N P S , E O S , D E L E S , P S ( 1 0 0 ) C O M M O N / V N U Z / N N U Z , E O Z , D E L E Z , U Z ( 1 0 0 ) L O G I C A L I S , P R N T 1 C A L L P A G E ( 2 ) C A L L D A T A ( & 9 9 9 ) I = P ( 1 ) G O T O d O O , 2 0 0 , 3 0 0 , 4 0 0 , 5 0 0 , 6 0 0 ) , I C A L L P A G E ( l ) W R I T E ( 6 , 2 0 ) 2 0 F O R M A T ( ' I N V A L I D D A T A I G N O R E D ' ) G O T O 1 C C I N D E X = 1 I N I T I A L I Z E C - I F P 2 = 0 I N I T I A L I Z E T R A N S F E R M A T R I X C E N E R G Y A N D S O N L Y ( T H R O U G H E N T R Y " I N I T A " ) 1 0 0 I F ( P ( 2 ) . E Q . l ) G 0 T O 1 0 1 C = P ( 3 ) D E L T A = P ( 4 ) / 5 7 . 2 9 5 7 8 N P S = 0 N N U Z = 0 I F ( P ( 5 ) . E Q . O . 0 ) G O T O 5 0 R E A D ( 1 , 1 1 1 ) N P S , E O S , D E L E S R E A D ( 1 , 1 1 2 ) ( P S ( I ) , 1 = 1 , N E S ) 5 0 I F ( P ( 6 ) . E Q . 0 . 0 ) G O T O 5 1 R E A D ( 2 , 1 1 1 ) N N U Z , E O Z , D E L E Z R E A D ( 2 , 1 1 2 ) ( U Z ( I ) , 1 = 1 , N N U Z ) 1 1 1 F O R M A T ( I 5 , 5 X , 2 F 1 0 . 0 ) 1 1 2 F O R M A T ( 8 F 1 0 . 0 ) 5 1 C A L L P A G E ( l ) W R I T E ( 6 , 1 9 ) W R I T E ( 3 , 6 8 ) M N T 6 8 F O R M A T ( ' ' , 5 A 4 ) 1 9 F O R M A T ( ' I N I T I A L I Z E ' ) C A L L I N I T GO T O 1 1 0 1 C A L L P A G E ( l ) W R I T E ( 6 , 1 1 ) 11 F O R M A T ( ' I N I T I A L I Z E T R A N S F E R M A T R I X O N L Y 1 ) C A L L I N I T A G O T O 1 C C - T R A N S F E R T O S U B R O U T I N E " T R A C K " 2 0 0 C A L L P A G E ( l ) W R I T E ( 6 , 1 2 ) 1 2 F O R M A T ( ' T R A C K • ) C A L L T R A C K GO T O 1 C C - M A T C H T O N U Z = P 2 3 0 0 C A L L P A G E ( l ) W R I T E ( 6 , 1 3 ) 1 3 F O R M A T ( ' T R A N S F O R M B A C K ' ) C A L L U N T R K ( P ( 2 ) ) G O T O 1 C C — D R A W E L L I P S E S O N P L O T T E R 4 0 0 C A L L P A G E ( 1 ) W R I T E ( 6 , 1 4 ) 1 4 F O R M A T ( 1 D R A W E L L I P S E S ' ) C A L L D R A W ( P ( 2 ) , P ( 3 ) ) GO T O 1 C C - C A L C U L A T E E L L I P S E O V E R L A P S 5 0 0 C A L L P A G E ( l ) W R I T E ( 6 , 1 5 ) 1 5 F O R M A T ( ' C A L C U L A T E E L L I P S E O V E R L A P S ' ) C A L L C O M P G O T O 1 C C - E N D O F R U N 6 0 0 W R I T E ( 6 , 1 6 ) 1 6 F O R M A T ( ' E N D O F R U N ' ) I F ( I S ) C A L L P L O T N D S T O P 1 9 9 9 S T O P 9 9 9 E N D S U B R O U T I N E I N I T C ^ ' >.' v'j- •>'f «-V •.»> sO- y1.* «A» O- «,<. -sX. %X. -vl/- O- -J< -J* »X. ^1, 0> N V mi* vU Oi» v-. «.'- vV \lf V < Vf vJ* %)r *Xr <JI* Ox -l* T K I T "T" ^r* *^  * i ^ i * * T* T* *^ r^  nr* **p' I^** **rv IS* o** ^ l * - f^* ^ ^ i * * ^r* r* **r% ,nf* I^^ * ^* *"r* J | \ | I | C - T H I S R O U T I N E D O E S A L L I N I T I A L I Z A T I O N C A N D S H O U L D B E C A L L E D O N C E F O R E A C H C C A S E T O B E R U N . C - O N E D A T A C A R D I S R E Q U I R E D C O M M O N / U S D / U S E D C O M M O N / E L S T / A L ( 1 3 ) , B E ( 1 3 ) , G A ( 1 3 ) C O M M O N / E L L I P S / A L F A ( 1 3 ) , B E T A ( 1 3 ) , G A M M A ( 1 3 ) C O M M O N / C A R D / P ( 8 ) , M N T ( 5 ) C O M M O N / T T / T ( 2 , 2 , 1 3 ) , E ( 1 3 ) , S ( 1 3 ) , P A S E ( 1 3 ) 197 C O M M O N / D I R / B K W D » E N D ( 1 3 ) , B A D ( 1 3 ) C O M M O N / S T A R T / E S T A R T , Z 1 ( 1 3 ) , Z I P ( 1 3 ) , Z 2 ( 1 3 ) , Z 2 P ( 1 3 ) » E P S » E M A X C O M M O N / S T A R T 2 / F I O , D E L T A , C , T H T A C O M M O N / P L T / I S , P R N T C O M M O N / M O R P L T / I Z 1 , I Z 2 , I E V C O M M O N / P G E / N , N P A G E , N A M E ( 5 ) D A T A I F S T / O / I F ( I F S T . E Q . l ) G O T O 5 6 7 4 I F S T = 1 U S E D = 0 . 0 5 6 7 4 C O N T I N U E . D O U B L E P R E C I S I O N A L , B E , G A D O U B L E P R E C I S I O N A L F A , B E T A , G A M M A , T , E L O G I C A L B K W D , E N D , P R N T , I S , E R R , B A D L O G I C A L I Z 1 , I Z 2 , I E V I Z 1 = . F A L S E . I Z 2 = . F A L S E . I E V = . F A L S E . P R N T = . T R U E . B K W D = . F A L S E . N = 0 N P A G E = 0 DO 2 3 9 1 = 1 , 5 2 3 9 N A M E ( I ) = M N T ( I ) C A L L P A G E ( 6 1 ) C A L L P A G E ( 2 ) C A L L D A T A ( & 9 9 9 ) F I O = P ( 7 ) / 5 7 . 2 9 5 7 8 F I S A V E = F I O T H T A =F IO I F ( P ( 5 ) . N E . O . O ) B K W D = . T R U E . E M A X = 1 0 0 0 0 0 . I F ( P ( 6 ) . N E . 0 . 0 ) E M A X = P ( 6 ) E S T A RT = P ( 1 ) S Q E = S Q R T ( E S T A R T ) A L F = P ( 4 ) Z M A X = P ( 3 ) E P S = P ( 2 ) * S Q E / 1 0 0 0 . B E T = Z M A X * * 2 / E P S G A M = ( 1 . 0 + A L F * A L F ) / ( B E T ) S Q E P S = S Q R T ( E P S ) D O 9 4 1 = 1 , 1 3 A L F A ( I ) = A L F B E T A ( I ) = B E T B A D ( I ) = . F A L S E . 9 4 G A M M A ( I ) = G A M C C - T H I S E N T R Y I N I T I A L I Z E S T H E T R A N S F E R C M A T R I X E N E R G Y A N D S O N L Y E N T R Y I N I T A T H T A = F 1 0 T H T A = 0 . 0 D O 9 6 1 = 1 , 1 3 P A S E ( I ) = ( ( 1 - 7 ) * 1 0 . + F I S A V E ) / 5 7 . 2 9 5 7 7 9 A L ( I ) = A L F A ( I ) B E ( I ) = B E T A ( I ) G A ( I ) = G A M M A ( I ) Z I ( I ) = S O E P S / D S Q R T ( G A M M A ( I ) ) Z 1 P ( I ) = 0 . 0 Z 2 ( I ) = 0 . 0 - 198 Z2P(I)=SQE PS/(DSORT(BETA(I ) )) END(I) = . F A L S E . E(I)=ESTART S( I )=0.0 T ( 1 , 1 , 1 ) =1 . 0 T( 1 »2 , I )=0.0 T ( 2 , l t I ) = 0 . 0 96 T ( 2 , 2 , I ) = 1 . 0 CALL PAGE(l) WRITE(6,100 ) 100 FORMAT(• INITIAL VALUES') CALL PRINT CALL POINTS RETURN 999 STOP 998 END SUBROUTINE TRACK • ' i ^ ' r ' r ^ T * r -v -T-1* ' i - ^ - i - i - t c ^ -v- ' r ^ ^ ' r ^  ^ *r- *r- -v- *r* «r* •¥• « v 1 - «v -v - r • ' i * "V ^ ^ ^ if. -V *f. | ,Q (\ C -THIS SUBROUTINE READS THE DATA CARDS C WHICH DESCRIBE THE ELEMENTS AND C TRANSFERS CONTROL TO SUBROUTINES WHICH C CALCULATE THE ACTUAL MATRIX ELEMENTS. COMMON/CARD/P(8 ) ,MNT(5 ) COMMON/PLT/IS ,PRNT C0MM0N/M0RPLT/IZI,I Z2 , IEV COMMON/SQALE/XSKALE,YSKALE COMMON /SLIP/NPS,E0S,DELES,PS(100) COMMON /VNUZ/NNUZ,EOZ,DELEZ,UZ(100) LOGICAL IZ1 , IZ2 , IEV LOGICAL LENS,PRNT, IS LOGICAL LLL ,LALL LLL= .FALSE . 11 CALL PAGE(2) CALL DATA(&999) K0UNT=1 I = P ( 1 ) GO T 0 ( 1 , 2 , 3 , 4 , 5 ,6 ) , I CALL PAGE(l) WRITE(6,100) 100 FORMAT(1 INVALID DATA IGNORED BY TRACK') GO TO 11 C T H I N LENS 1 L ENS =.TRUE . T2 = P(2 ) T3=P (3 ) 21 CALL TLEN(T2 ,T3 ) IF(PRNT )CALL PRINT IF ( LLL ) CALL POINTO K0UNT=K0UNT-1 IF (KOUNT.NE.O)GO TO 22 GO TO 11 C CONSTANT NUZ REGION 2 LENS=.FALSE. Q2=P(2) Q3 = P (3 ) 22 CALL NUZ(Q2,Q3) IF(PRNT)CALL PRINT IF(LLL ) CALL POINTQ K0UNT=K0UNT-1 IF(KOUNT.NE.O)GO TO 21 GO T O 1 1 C S E T U P K O U N T F O R R E P E T I T I O N O F P R E V I O U S T W O E L E M E N T S 3 K O U N T = 2 . * ( P ( 2 ) - l . ) I F ( L E N S ) G O T O 2 2 GO T O 2 1 C S E T P R I N T O N O R O F F 4 I F ( P ( 2 ) . N E . 0 . 0 ) G O T O 8 C A L L P A G E ( l ) W R I T E ( 6 , 2 0 0 ) 2 0 0 F O R M A T ( ' P R I N T O F F • ) P R N T = . F A L S E . G O T O 11 8 I F ( P ( 2 ) . N E . 1 . 0 ) G 0 T O 11 C A L L P A G E ( l ) W R I T E ( 6 , 2 0 1 ) 2 0 1 F O R M A T ( ' P R I N T ON ' ) P R N T = . T R U E . G O T O 11 C S E T S W I T C H E S T O C O N T R O L P L O T T I N G O F Z 1 , Z 2 , A N D E N V 5 I = P ( 2 ) I F ( I . N E . 1 ) G 0 T O 6 1 L L L = . T R U E . X S K A L E = P ( 3 ) Y S K A L E = P ( 4 ) I F ( X S K A L E . E Q . 0 . 0 ) X S K A L E = 1 . 0 I F ( Y S K A L E . E Q . 0 . 0 ) Y S K A L E = 0 . 5 GO T O 1 1 6 1 I F ( I . N E . 2 ) G 0 T O 6 2 L L L = . F A L S E . G O T O 11 6 2 I Z 1 = . F A L S E . I Z 2 = . F A L S E . I E V = . F A L S E . L A L L = . F A L S E . I F ( I . E 0 . 3 ) I Z 1 = . T R U E . I F ( I . E Q . 4 ) I Z 2 = . T R U E . I F ( I • E O . 5 ) I E V = . T R U E . I F { I , N E . 6 ) G 0 T O 6 3 I Z 1 = . T R U E . I Z 2 = . T R U E . 6 3 I F ( I . N E . 7 ) G 0 T O 6 4 I Z l = . T R U E . I E V = . T R U E . 6 4 I F ( I . N E . 8 ) G 0 T O 6 5 I Z 2 = . T R U E . I E V = . T R U E . 6 5 I F ( I . N E . 9 ) G 0 T O 6 6 I Z l = . T R U E . I Z 2 = . T R U E . I E V = . T R U E . 6 6 I F ( P ( 3 ) . E Q . 9 9 9 . ) L A L L = . T R U E . C A L L P L 0 ( I Z 1 , I Z 2 , I E V , L A L L , I F I X ( P ( 3 ) ) , I F I X ( P ( 4 ) ) ) GO T O 11 C R E T U R N T O M A I N 6 R E T U R N 9 9 9 S T O P 1 2 3 4 E N D S U B R O U T I N E N U Z ( P 1 , P 2 ) r^- ^ *ir:' 'f* 3|i 5^* ^ 'i^ ^ 1^* 'l'- r^* 'l3- -r- - i ' ^i' r^* -"I^  1^' ^ ''^ r^* ^ '1^  -i' ^ ^ ^ 5jC ^Ji i j i 5j< ^ < 5j< ?[c ijc 5 j i 5 j c 3j< |\j j^J ^ C - T H I S R O U T I N E C A L C U L A T E S T H E M A T R I X .200 C E L E M E N T S F O R C O N S T A N T N U Z M A G N E T I C C F I E L D R E G I O N S . C O M M O N / D I R / B K W D , E N D ( 1 3 ) , B A D ( 1 3 ) C O M M O N / T T / T ( 2 , 2 , 1 3 ) , E ( 1 3 ) , S ( 1 3 ) , P A S E ( 1 3 ) C O M M O N / E L E M / E L ( 2 , 2 ) C O M M O N / P L T / I S , P R N T C O M M O N / S T A R T 2 / F I O , D E L T A , C T H T A C O M M O N / S L I P / N P S , E O S , D E L E S , P S ( 1 0 0 ) C O M M O N / V N U Z / N N U Z , E O Z , D E L E Z , U Z ( 1 0 0 ) D I M E N S I O N R E M ( 1 3 ) L O G I C A L I S , P R N T D O U B L E P R E C I S I O N T , E L , E L O G I C A L B K W D , E N D » B A D T 1 = P 1 T H T = P 2 * 5 . 0 / 5 7 . 2 9 5 7 8 F I O = F I O + T H T T H T A = T H T A + T H T T 2 = P 2 I R E M = 1 R E M ( 1 ) = P 1 1 0 5 F O R M A T ( ' O M A G N E T I C F I E L D , A N G U L A R L E N G T H = • , F 7 . 2 , + « N U Z = « , 1 3 F 6 . 2 ) D O 7 0 1 = 1 , 1 3 I F ( E N D ( I ) ) G 0 T O 7 0 I F ( B A D ( I ) ) G 0 T O 7 0 E E = E ( I ) S Q E = S Q R T ( E E ) I F ( N N U Z . E Q . O ) G 0 T O 1 1 7 T 1 = U T E R P ( E E ) C W R I T E ( 6 , 1 2 9 ) T 1 C 1 2 9 F O R M A T ( • • , E 1 6 . 8 ) I R E M = I R E M + 1 R E M ( I R E M - 1 ) = T 1 1 1 7 R = 1 8 . 9 4 * S Q E S S = R * T 2 / 5 7 . 2 9 5 7 7 9 5 1 3 0 8 2 3 2 0 9 S ( I ) = S ( I ) + S S P A S E ( I ) = P A S E ( I ) + T H T I F ( N P S . N E . O ) P A S E U ) = P A S E ( I ) + S T E R P ( E E ) Q = T 1 * S S / R S I = S I N ( 0 ) C O = C O S ( Q ) E L (1 , 1 ) = C 0 E L ( 1 , 2 ) = S S * S 1 / ( Q * S Q E ) E L ( 2 , 1 ) = - Q * S I * S Q E / S S E L ( 2 , 2 ) = C 0 C A L L M A T M U L ( I ) C A L L U P D A T E ( I ) 7 0 C O N T I N U E I F ( . N O T . P R N T ) G 0 T O 3 2 I R E M = I R E M - 1 C A L L P A G E ( 2 ) W R I T E ( 6 , 1 0 5 ) P 2 , ( R E M ( I ) , 1 = 1 , I R E M ) 3 2 R E T U R N E N D S U B R O U T I N E T L E N ( P 1 , P 2 ) C - T H I S R O U T I N E C A L C U L A T E S T H E P H A S E C A N D E N E R G Y G A I N R E Q U I R E D T O C O M P U T E C T H E E L E C T R I C L E N S E F F E C T S . C - S U B R O U T I N E T L E N S C A L C U L A T E S T H E '201 C C H A N G E S I N S L O P E A N D D I S P L A C E M E N T C C A U S E D B Y T H E L E N S . C O M M O N / D I R / B K W D , E N D ( 1 3 ) , B A D ( 1 3 ) C O M M O N / T T / T ( 2 , 2 , 1 3 ) , E ( 1 3 ) , S ( 1 3 ) , P A S E ( 1 3 ) C O M M O N / E L E M / E L ( 2 , 2 ) C O M M O N / S T A R T / E S T A R T , Z l ( 1 3 ) , Z 1 P ( 1 3 ) , Z 2 ( 1 3 ) , Z 2 P ( 1 3 ) , E P S , E M A X C O M M O N / P L T / I S , P R N T C O M M O N / S T A R T 2 / F I O , D E L T A , C , T H T A L O G I C A L I S , P R N T D O U B L E P R E C I S I O N T , E L , E D P 1 = P 1 D P 2 = P 2 L O G I C A L B K W D , E N D , B A D 1 0 4 F O R M A T ( ' O T H I N L E N S E N E R G Y G A I N = ' , F 7 . 3 , ' R E D U C T I O N F A C T O R = • + , F 7 . 3 , ' R . F P H A S E A T G A P W I T H N O P H A S E S L I P I S ' F 8 . 2 , + • ( » , F 6 . 2 , • ) ' ) D I M E N S I O N Z Z Z ( 1 3 ) , Z Z X ( 1 3 ) D O 6 0 1 = 1 , 1 3 F I = P A S E ( I ) — T H T A C T H E F O L L O W I N G E X P R E S S I O N F O R T H E E N E R G Y G A I N A L L O W S T H E C M I X T U R E O F T H I R D H A R M O N I C T O B E S P E C I F I E D B Y D E L T A ( T H E P H A S E C D I F F E R E N C E B E T W E E N T H E F I R S T A N D T H I R D H A R M O N I C ) A N D C W H E R E C C = E P S I L O N * C O S ( D E L T A ) ; E P S I L O N I S T H E R E L A T I V E A M P L I T U D E O F T H E C A N D T H I R D H A R M O N I C S D E L ' E = D P 1 * ( C O S ( F I ) - C * C O S ( 3 . * F I ) + C * T A N ( D E L T A ) * S I N ( 3 . * F I ) ) I F ( B K W D ) D E L E = " D E L E I F ( E ( I ) + D E L E . L T . O . O ) E N D ( I ) = . T R U E . I F ( E ( I ) . G T . E M A X ) E N D ( I ) = . T R U E . I F ( E N D ( I ) ) G O T O 6 0 I F ( B A D ( I ) ) G 0 T O 6 0 C A L L T L E N S ( E ( I ) + D E L E / 2 . , F I , D P 1 , A ) Z A = D S Q R T ( E ( I ) ) / D S Q R T ( E ( I ) + D B L E ( D E L E ) ) Z A = 1 . 0 - Z A I F ( B K W D ) A = « A I F ( B K W D ) Z A = - Z A I F ( D P 2 . E Q . 0 . 0 ) G 0 T O 2 0 A = D P 2 * A Z A = D P 2 * Z A 2 0 Z Z Z ( I ) = A Z Z X ( I ) = Z A E L ( 1 , 1 ) = 1 . O - Z A E L ( 2 , 1 ) = — A * ( D S Q R T ( E ( I ) ) + D S Q R T ( E ( I ) + D B L E ( D E L E ) ) ) / 2 . E L ( 2 , 2 ) = 1 . 0 E L ( 1 , 2 ) = - ( 1 . O - E L ( 1 , 1 ) ) / E L ( 2 , 1 ) E ( I ) = E ( I ) + D E L E C A L L M A T M U L ( I ) C A L L U P D A T E ( I ) 6 0 C O N T I N U E I F ( . N O T . P R N T ) G 0 T O 7 3 4 C A L L P A G E ( 4 ) T H P N = T H T A * 5 7 . 2 9 5 7 8 T H P M = A M 0 D ( T H P N , 3 6 0 . ) W R I T E ( 6 , 1 0 4 ) P I , P 2 , T H P N , T H P M W R I T E ( 6 , 1 0 0 1 ) Z Z Z , Z Z X 1 0 0 1 F O R M A T ( • • , 1 3 F 7 . 3 ) 7 3 4 R E T U R N E N D S U B R O U T I N E T L E N S ( E , T H E T A R , D E L E , Z Z ) C sli i!c it i'i s!f i 1' o»- s»» -Jr o«- ^ >A- -j* o* o» >J» - J - »y j» <j» « U ^ «J* *Xr . A . o> •*>' v^. o~ ^t, ~T I r~ K I C C - T H I S R O U T I N E C A L C U L A T E S T H E D I S P L A C E M E N T ,202 C A N D S L O P E C H A N G E S C A U S E D B Y T H E T H I N L E N S . C - F l A N D F 2 A R E T H E F A C T O R S D E S C R I B E D B Y C R O S E I N -C P H Y S , R E V . V O L ( 5 3 ) , 3 9 2 ( 1 9 3 8 ) C - F 3 , F 4 , A N D F 5 A R E T H E F A C T O R S D E S C R I B E D C B Y C O H E N I N -C R E V . S C C . I N S T R . V O L . 2 4 , 5 8 9 ( 1 9 5 3 ) C - T H E N U M E R I C A L V A L U E S A R E T H O S E A P P R O P R I A T E C T O T H E T R I U M F D E E G E O M E T R Y . C O M M O N / S T A R T / E S T A R T , Z 1 ( 1 3 ) , Z 1 P ( 1 3 ) , Z 2 ( 1 3 ) , Z 2 P ( 1 3 ) , E P S , E M A X C O M M O N / S T A R T 2 / F I O , D E L T A , C T H T A P I = 3 . 1 4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 S I = S I N ( T H E T A R ) - 3 . * C * C O S ( 3 . * T H E T A R ) * T A N ( D E L T A ) - 3 . * C * S I N ( 3 . * T H E T A R ) C O = C O S ( T H E T A R ) - C * C O S ( 3 . * T H E T A R ) + C * T A N ( D E L T A ) * S I N ( 3 . * T H E T A R ) E V O E C = . 5 * D E L E / E C W R I T E ( 6 , 1 0 0 ) E , T H E T A R , D E L E , S I , C O , E V O E C I F ( E . L T . O . O ) S T O P 4 5 6 R = 1 8 . 9 4 * S Q R T ( E ) I F ( D E L E . N E . 0 . 1 ) G O T O 1 F = . 9 7 5 G O T O 3 1 I F ( R . G T . 3 0 . 0 ) G 0 T O 2 F = l . 0 7 « 0 . 0 1 5 5 * R GO T O 3 2 F = 0 . 6 0 5 3 F 1 = 5 . * E V 0 E C * S I / R F 2 = 2 * F * E V O E C * E V O E C * C O * C O / ( P 1 * 2 . 0 ) C F 3 = - E V 0 E C * E V 0 E C * S I * S I / ( . 2 * R ) C F 4 = - . 4 * E V 0 E C * E V 0 E C * C 0 * C 0 / R C F 5 = 5 . * E V 0 E C * E V 0 E C * S I / R F 1 2 = F 1 + F 2 C F l 5 = F 1 2 + F 3 + F 4 + F 5 Z Z = F 1 2 C Z Z = F 1 5 C W R I T E ( 6 , 1 0 0 ) F 1 , F 2 , R , Z Z R E T U R N C 1 0 0 F O R M A T ( • ' , 6 G 1 0 . 3 ) E N D S U B R O U T I N E U P D A T E ( I ) C * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * U P D A T E C - T H I S R O U T I N E C A L C U L A T E S C T H E N E W E L L I P S E C O E F F I C I E N T S F R O M T H E C I N I T I A L V A L U E S O F T H E C O E F F I C I E N T S A N D C T H E C U R R E N T 2 X 2 T R A N S F E R M A T R I X . C O M M O N / E L S T / A L ( 1 3 ) , B E ( 1 3 ) , G A ( 1 3 ) C O M M O N / E L L I P S / A L F A ( 1 3 ) , B E T A ( 1 3 ) , G A M M A ( 1 3 ) C O M M O N / T T / T ( 2 , 2 , 1 3 ) , E ( 1 3 ) , S ( 1 3 ) , P A S E ( 1 3 ) C O M M O N / E L E M / E L ( 2 , 2 ) C O M M O N / D I R / B K W D , E N D ( 1 3 ) , B A D ( 1 3 ) L O G I C A L B K W D , E N D , B A D D O U B L E P R E C I S I O N A L , B E , G A , T E S T D O U B L E P R E C I S I O N T , A L F A , B E T A , G A M M A , E L D O U B L E P R E C I S I O N C , C P , S S , S P , A L F , B E T , G A M , E C = T ( 1 , 1 , 1 ) C P = T ( 2 , 1 , I ) S S = T ( 1 , 2 , I ) S P = T ( 2 , 2 , 1 ) A L F = A L ( I ) 6 E T = B E ( I ) G A M = G A ( I ) C T H E F O L L O W I N G T H R E E T E S T S C A U S E T E R M I N A T I O N O F T H E C C A L C U L A T I O N F O R A N Y P H A S E F O R W H I C H A N Y O N E O F T H E C F O L L O W I N G C O N D I T I O N S O C C U R : C ( 1 ) B E T A < 0 C ( 2 ) G A M M A > 0 C ( 3 ) B E T A * G A M M A - A L F A * * 2 - 1 > O . O O l C T H E S E C O N D I T I O N S O C C U R W H E N B E T A O R G A M M A B E C O M E L A R G E C S O T H A T T H E R E I S N O T S U F F I C I E N T P R E C I S I O N T O C C A L C U L A T E T H E M P R O P E R L Y B E T A ( I ) = C * C * B E T - 2 . * C * S S * A L F + S S * S S * G A M I F ( B E T A ( I ) . G E . 0 . 0 1 G 0 T O 2 0 0 C A L L P A G E ( l ) I P = ( I - 7 ) * 1 0 W R I T E ( 6 , 1 ) I P B A D ( I ) = . T R U E . B E T A ( I ) = - B E T A ( I ) R E T U R N 2 0 0 A L F A ( I ) = - C * C P * B E T + ( C * S P + S S * C P ) * A L F - S S * S P * G A M G A M M A ( I ) = C P * C P * B E T - 2 . * C P * S P * A L F + S P * S P * G A M I F ( G A M M A ( I ) . G E . O . O G O T O 2 0 1 C A L L P A G E ( l ) I P = ( I - 7 ) * 1 0 W R I T E ( 6 , 2 ) I P B A D ( I ) = . T R U E . G A M M A ( I ) = - G A M M A ( I ) R E T U R N 2 0 1 T E S T = 6 E T A ( I ) * G A M M A ( I ) - A L F A { I ) * A L F A ( I ) - 1 . I F ( D A B S ( T E S T ) . L T . 0 . 0 0 1 ) R E T U R N C A L L P A G E ( l ) I P = ( 1 - 7 ) * 1 0 W R I T E ( 6 , 3 ) I P B A D ( I ) = . T R U E . 1 F O R M A T ( 1 C A L C U L A T I O N O F F I = ' , 1 4 , • T E R M I N A T E D D U E ' X • T O N E G A T I V E B E T A ' ) 2 F O R M A T ( • C A L C U L A T I O N O F F I = ' , 1 4 , 1 T E R M I N A T E D D U E ' X ' T O N E G A T I V E G A M M A ' ) 3 F O R M A T ( ' C A L C U L A T I O N O F F I = ' , 1 4 , ' T E R M I N A T E D D U E ' X ' T O B * G - A * A N O T E Q U A L T O 1 . ' ) R E T U R N E N D S U B R O U T I N E M A T M U L ( I ) Q ^ I ' l^' -"r- 'r- ^ r- -^ r- ~r~ 'I' 'r- 1^' 'r- 'o ^ ^ »!' 'r- -^ r- *r- *>' 'i' -'I' ' i ' 'r- 3 r 3!' ' i ' ^ '1^  ^  *p 5o 'i5- 'i5- 'r- 'r- ^ ^ ^ ^  ; ' c -4^  )^/\"J" M U L C - T H I S R O U T I N E M U L T I P L I E S T H E O L D C T R A N S F E R M A T R I X B Y T H E M A T R I X F O R T H E C U R R E N T E L E M E N T T O C P R O D U C E T H E N E W T R A N S F E R M A T R I X C 0 M M 0 N / T T / T ( 2 , 2 , 1 3 ) , E ( 1 3 ) , S ( 1 3 ) , P A S E ( 1 3 ) C O M M O N / E L E M / E L ( 2 , 2 ) C O M M O N / D I R / B K W D , E N D ( 1 3 ) , B A D ( 1 3 ) L O G I C A L B K W D , E N D , B A D D O U B L E P R E C I S I O N T , E L , E D O U B L E P R E C I S I O N T 1 1 , T 1 2 , T 2 1 , T 2 2 , T A L O G I C A L E R R T 1 1 = T ( 1 , 1 , I ) T 1 2 = T ( 1 , 2 , I ) T 2 1 = T ( 2 ,1 ,1 ) T 2 2 = T ( 2 , 2 , I ) T ( 1 , 1 , I ) = T 1 1 * E L ( 1 , 1 ) + T 2 1 * E L ( 1 , 2 ) T ( 1 , 2 , I ) = T 1 2 * E L ( 1 , 1 ) + T 2 2 * E L ( 1 , 2 ) T ( 2 , l , 1 ) = T 1 1 * E L ( 2 , 1 ) + T 2 1 * E L ( 2 , 2 ) T ( 2 , 2 , I ) = T 1 2 * E L ( 2 , 1 ) + T 2 2 * E L ( 2 , 2 ) 204 C - T H E F O L L O W I N G S T A T E M E N T S C H E C K T H A T T H E D E T E R M I N A N T C O F T H E T R A N S F E R M A T R I X I S W I T H I N . 0 0 1 O F 1 C - I F N O T , T H E C A L C U L A T I O N I S T E R M I N A T E D C - T H I S O C C U R S W H E N T H E M A T R I X E L E M E N T S B E C O M E L A R G E C S O T H A T T H E D E T E R M I N A N T C A N N O T B E C A L C U L A T E D A C C U R A T E L Y T A = T ( 1 , 1 , I ) * T ( 2 , 2 , I ) - T ( 1 , 2 , I ) * T ( 2 , 1 , I ) - l . I F ( D A B S ( T A ) . L T . O . 0 0 1 ) R E T U R N C A L L P A G E ( l ) I P = ( 1 - 7 ) * 1 0 W R I T E ( 6 , 1 0 0 ) I P 1 0 0 F O R M A T ( ' C A L C U L A T I O N O F F I = ' , 1 4 , « T E R M I N A T E D D U E * X ' T O D E T O F T N O T E Q U A L T O l . » ) B A D ( I ) = . T R U E . R E T U R N E N D S U B R O U T I N E U N T R K ( X N U Z ) C J * n1* V ' *V »•*' S1' "V >^ «J* «••> +t* v1* NI* Oa* O* Oa" O* O* Oa> O* Oa> ol* »•* 0*r Oar Oa" *>'* V* *>'•* "J* »V *•'*" *'(* »•*«• *V **V "^ "* J - * >V »'* *••* J * I I l\ 1 "T* D 1/ •y. *.> -v- ^  v *,«. *,> ^  'f ^- 'f -|- »v i - - i - "V- -V »> "V- -v- -T- " i " •*»- - r * r -r- ' i - -v -v- - i " T- -V 'I- U j\J | K I N C P A R A M E T E R S W H I C H A R E R E Q U I R E D T O M A T C H C T H E B E A M E L L I P S E T O T H E G I V E N N U Z . C T H E N I T C A L C U L A T E S T H E I N V E R S E O F T H E C C U R R E N T 3 X 3 T R A N S F E R M A T R I X F O R T H E C E L L I P S E C O E F F I C I E N T S , A N D M U L T I P L I E S T H E C R E Q U I R E D F I N A L V E C T O R B Y T H E I N V E R S E C M A T R I X T O D E T E R M I N E W H A T S T A R T I N G E L L I P S E C P A R A M E T E R S W I L L G I V E T H E R E Q U I R E D F I N A L V E C T O R . C O M M O N / C A R D / P ( 8 ) , M N T ( 5 ) C O M M O N / T T / T ( 2 , 2 , 1 3 ) , E ( 1 3 ) , S ( 1 3 ) , P A S E ( 1 3 ) C O M M O N / E L L I P S / A L F A ( 1 3 ) , B E T A ( 1 3 ) , G A M M A ( 1 3 ) C O M M O N / S T A R T / E S T A R T , Z I ( 1 3 ) , Z 1 P ( 1 3 ) , Z 2 ( 1 3 ) , Z 2 P ( 1 3 ) , E P S , E M A X C O M M O N / D I R / B K W D , E N D ( 1 3 ) , B A D ( 1 3 ) C O M M O N / V N U Z / N N U Z , E O Z , D E L E Z , U Z ( 1 0 0 ) L O G I C A L B K W D , E N D , B A D D O U B L E P R E C I S I O N T , A L F A , B E T A , G A M M A , E D O U B L E P R E C I S I O N T 11 , T 1 2 , T 2 1 , T 2 2 D O U B L E P R E C I S I O N E O ( 3 , 3 ) , E I ( 3 , 3 ) , S T ( 3 ) , E N ( 3 ) I F ( N N U Z . N E . 0 ) X N U Z = U T E R P ( E M A X ) C A L L P A G E ( l ) W R I T E ( 6 , 1 0 9 ) X N U Z 1 0 9 F O R M A T ( • M A T C H T O N U Z = 1 , F 7 . 3 ) S T ( 1 ) = 1 8 . 9 4 / X N U Z S T ( 3 ) = 1 . / S T ( 1 ) S T ( 2 ) = 0 . 0 D O 8 0 0 K = l , 1 3 I F ( B A D ( K ) ) G 0 T O 8 0 0 F I = F L O A T ( K ™ 7 ) * 1 0 C A L L P A G E ( 8 ) W R I T E ( 6 , 1 0 3 ) F I 1 0 3 F O R M A T ( ' O P H A S E = ' , F 4 . 0 / X« M A T R I X • , 4 0 X , • I N V E R S E 1 ) T 1 1 = T ( 1 ,1 ,K) T 1 2 = T ( 1 , 2 , K ) T 2 1 = T ( 2 , 1 , K ) T 2 2 = T ( 2 , 2 , K ) C 3 X 3 M A T R I X C O M P O N E N T S E 0 ( 1 , 1 ) = T 1 1 * T 1 1 E 0 ( 1 , 2 ) = - 2 . * T 1 1 * T 1 2 E 0 ( 1 , 3 ) = T 1 2 * T 1 2 E O ( 2 , 1 ) = - T l l * T 2 1 E 0 ( 2 , 2 ) = T 1 1 * T 2 2 + T 2 1 * T 1 2 E 0 ( 2 , 3 ) = - T 1 2 * T 2 2 E 0 ( 3 , l ) = T 2 1 * T 2 1 E 0 ( 3 , 2 ) = - 2 . * T 2 1 * T 2 2 E 0 ( 3 , 3 ) = T 2 2 * T 2 2 C 3 X 3 I N V E R S E M A T R I X C O M P O N E N T S E I ( 1 , 1 ) = T 2 2 * T 2 2 E I ( 1 , 2 ) = 2 . * T 1 2 * T 2 2 E I ( 1 , 3 ) = T 1 2 * T 1 2 E I ( 2 , 1 ) = T 2 1 * T 2 2 E I ( 2 , 2 ) = T 1 1 * T 2 2 + T 2 1 * T 1 2 E 1 ( 2 , 3 ) = T 1 1 * T 1 2 E I ( 3 , 1 ) = T 2 1 * T 2 1 E I ( 3 , 2 ) = 2 . * T 1 1 * T 2 1 E I ( 3 , 3 ) = T 1 1 * T 1 1 D O 1 0 I J = 1 , 3 W R I T E ( 6 , 1 0 0 ) ( E 0 ( I J , I L ) , E I ( I J , I L ) , I L = 1 , 3 ) 1 0 0 F O R M A T ( * ' , 3 E 1 1 . 3 , 1 3 X , 3 E 1 1 . 3 ) 1 0 C O N T I N U E D O 6 7 1 = 1 , 3 6 7 E N ( I ) =E I ( I , 1 ) * S T ( 1 ) + E I ( I , 2 ) * S T ( 2 ) + E I ' ( I , 3 ) * S T ( 3 ) W R I T E ( 6 , 1 0 2 ) S T , E N 1 0 2 F O R M A T ( 1 I N I T I A L V E C T O R ' , 3 E 1 6 . 8 / X » F I N A L V E C T O R « , 3 E 1 6 . 8 ) B E T A ( K ) = E N ( 1 ) A L F A ( K ) = E N ( 2 ) G A M M A ( K ) = E N ( 3 ) 8 0 0 C O N T I N U E R E T U R N 9 9 9 S T O P 9 9 9 E N D S U B R O U T I N E D R A W ( S 1 , S 2 ) C o>x Ox *^r o>*- o^ - o*> o> *J<* **** Ox Ox ov 0*- o^  Ox Ox Ox ov Ox Ox- Ox Ox Ox Ox Ox ov ov Ox o> Ox Oy Ov- Ox Ox Ox Ox Ox Ox o^  o^  Ox Ox o* Ox Ox r~\ r*** A I _ I X)". 1 * "TP" "l*" Of*- O1* *|** O^ Of" * I * Of* •*!** *V* Of* Of* *r* IT* OP **P "V *V" *p *V*  "(** *P Of* xp- «*|-. X,-. xp. rf rf* rf rf\ rfs. rf. rf. rf* rf rf. xp. rf rft rf, rf xp >0> Jj> X|< xp I 1 W /\ |X| C - T H I S R O U T I N E D R A W S T H E E L L I P S E S O N A C C A L C O M P P L O T T E R . T H E S C A L E U S E D I S C R E A D I N ON T H E D A T A C A R D W H I C H C A U S E S C T R A N S F E R T O T H I S R O U T I N E C - E L L I P S E S W H I C H W O U L D GO O F F T H E P A G E C A R E T R U N C A T E D C O M M O N / U S D / U S E D C 0 M M 0 N / P L T / I R , P R N T C O M M O N / E L L I P S / A L F A ( 1 3 ) , B E T A ( 1 3 ) , G A M M A ( 1 3 ) C O M M O N / S T A R T / E S T A R T , Z 1 ( 1 3 ) , Z I P ( 1 3 ) , Z 2 ( 1 3 ) , Z 2 P ( 1 3 ) , E P S , E M A X C O M M O N / T T / T ( 2 , 2 , 1 3 ) , E ( 1 3 ) , S ( 1 3 ) , P A S E ( 1 3 ) C 0 M M 0 N / D I R / B K W D , E N D ( 1 3 ) , B A D ( 1 3 ) L O G I C A L B K W D , E N D , B A D C O M M O N / P G E / N , N P A G E , N A M E ( 5 ) D O U B L E P R E C I S I O N T , A L F A , B E T A , G A M M A , E L O G I C A L I R , I S , P R N T D I M E N S I O N X ( I O O O ) , Y ( 1 0 0 0 ) D A T A D E L P H I / . 0 0 6 2 8 3 1 8 / D A T A I S / . F A L S E . / I R = I S I F ( I S ) G 0 T O 1 C A L L P L O T S I S = . T R U E . I R = . T R U E . 1 C A L L P L 0 T ( U S E D , 0 . 0 , - 1 ) U S E D = 1 2 . 0 C A L L A X I S ( 5 . , 5 . , 1 0 H Z ( I N C H E S ) , 1 0 , 5 . , 0 . 0 , 0 . 0 , S 1 ) C A L L A X I S ( 5 . , 5 . , 1 2 H Z ' ( R A D I A N S ) , 1 2 , 5 . , 9 0 . , 0 . 0 , S 2 ) C A L L A X I S ( 5 . , 5 . , 1 H , - 1 , 5 . , 1 8 0 . , 0 . 0 , - S 1 ) C A L L A X I S ( 5 . , 5 . , I H , - 1 , 5 . , 2 7 0 . , 0 . 0 , - S 2 ) C A L L S Y M B O L ( 5 . 1 , 9 . 0 , . 2 5 , N A M E ( 1 ) , 0 . 0 , 2 0 ) D O 2 K = l , 1 3 I F ( B A D ( K ) ) G 0 T O 2 S Q E = D S Q R T ( E ( K ) ) A = A L F A ( K ) B = B E T A ( K ) * S Q E G= G A M M A ( K ) / S Q E T E M = G * S 1 * S 1 - B * S 2 * S 2 C I F ( T E M . G T . 0 . 1 E - 2 5 ) G 0 T O 5 2 1 C A N G = 1 . 5 7 0 8 C GO T O 5 2 2 C T H E F O L L O W I N G 5 S T A T E M E N T S C A L C U L A T E T H E A N G L E A T W H I C H C T O L A B E L T H E E L L I P S E . 5 2 1 A N G = . 5 * A T A N ( 2 . * A * S 1 * S 2 / T E M ) 5 2 2 I F ( T E M . L E . 0 . 0 ) G O T O 6 3 4 I F ( A . L T . O . O ) A N G = A N G + 1 . 5 7 0 8 I F ( A . G E . 0 . 0 ) A N G = A N G = 1 . 5 7 0 8 6 3 4 I F ( A N G . L T . O . O ) A N G = A N G + 6 . 2 8 3 1 8 E P Q = E P S / S Q E P H I = 0 . 0 D O 3 1 = 1 , 5 0 0 C O = C O S ( P H I ) S I = S I N ( P H I ) C S C A L E F A C T O R S C S 1 = Z I N C H E S P E R P L O T I N C H C S 2 = Z ' R A D I A N S P E R P L O T I N C H T E N = G * S 1 * S 1 * C 0 * C 0 + B * S 2 * S 2 * S I * S I + 2 . 0 * A * S 1 * S 2 * S I * C 0 I F ( T E N . G T . 0 . 1 E - 2 5 ) G O T O 5 2 3 R = 1 0 0 . G O T O 5 2 4 5 2 3 R = S Q R T ( E P Q / T E N ) 5 2 4 X ( I ) = R * C 0 + 5 . Y ( I ) = R * S 1 + 5 . X ( 1 + 5 0 0 ) = - R * C 0 + 5 . Y ( 1 + 5 0 0 ) = - R * S 1 + 5 . P H I N E W = P H I + D E L P H I I F ( P H I . L T . A N G . A N D . P H I N E W . G T . A N G ) L A B = I P H I = P H I N E W 3 C O N T I N U E I R S T = 1 0 0 0 C W R I T E ( 3 , 2 3 4 5 ) L A B C 2 3 4 5 F O R M A T ( ' ' , 1 6 ) DO 5 1 = 1 , 1 0 0 0 I F ( X ( I ) . L T . O . O . O R . X ( I ) . G T . 1 0 . 0 . O R . X Y ( I ) . L T . O . O . O R . Y ( I ) . G T . 1 0 . 0 ) G 0 T O 5 I F ( I . L T . I R S T ) I R S T = I 5 C O N T I N U E C A L L P L O T ( X ( I R S T ) , Y ( I R S T ) , 3 ) X N U M = F L 0 A T ( K - 6 ) * 1 0 . D O 4 1=1 , 1 0 0 0 I F ( X ( I ) . L T . 0 . . O R . X ( I ) . G T . 1 0 . . O R . Y ( I ) . L T . O . . O R . Y ( I ) . G T . 1 0 . ) X G O T O 1 2 X X = X ( I ) Y Y = Y ( I ) C A L L P L 0 T ( X X , Y Y , 2 ) 1 2 I F ( I . E O . L A B ) C A L L N U M B E R ( X X , Y Y , . 1 4 , X N U M , 0 . 0 , 0 ) 4 C O N T I N U E 2 C O N T I N U E C A L L P L O T ( X X , Y Y , 3 ) R E T U R N E N D S U B R O U T I N E P R I N T C o* o * o* o* o * o * o * o * o * o * o * o * o * o-» O* O* O* O* O- O* O* O* O* O* O* O* O* O* o * o* o* o * o * ou o , o* o * »v o * o* O- O* O* O* O* O* s'> O* o * •*> o* o* OL. o * o* o * O O T M T 1 % "V" *tf "C I"* "P *T* "V" *t* "l* "P ^r* *V" —P f* -P *P "P "P *p **P "Vf "V* If* 1* *P ""P n*1 *V" *P -P "P *T* *P T * •Hr" "IT* "T* *V* *"P IT* "P —I* *V *P "P —p T * *P —P *P nf* ^ ™ f"^  l \ X l \ I C - T H I S R O U T I N E P R I N T S T H E C U R R E N T T R A N S F E R C M A T R I X , E N E R G Y , S , E L L I P S E C O E F F I C I E N T S , C E N V E L O P E , A N D P R I N C I P L E T R A J E C T O R I E S F O R C E A C H P H A S E C O M M O N / T T / T ( 2 , 2 , 1 3 ) , E ( 1 3 ) , S ( 1 3 ) , P A S E ( 1 3 ) C O M M O N / E L L I P S / A L F A ( 1 3 ) , B E T A ( 1 3 ) , G A M M A ( 1 3 ) C O M M O N / S T A R T / E S T A R T , Z 1 ( 1 3 ) , Z 1 P ( 1 3 ) , Z 2 ( 1 3 ) , Z 2 P ( 1 3 ) , E P S , E M A X C O M M O N / D I R / B K W D , E N D ( 1 3 ) , B A D ( 1 3 ) L O G I C A L B K W D , E N D , B A D D O U B L E P R E C I S I O N A L F A , B E T A , E , G A M M A , T , T A C A L L P A G E ( 3 ) W R I T E ( 6 , 1 0 1 ) 1 0 1 F O R M A T ( / 1 A F T E R L A S T E L E M E N T • X / 4 X , ' P H A S E • , 6 X , ' T 11 » , 8 X , « T 1 2 ' , 9 X , • T 2 1 • X , 8 X , ' T 2 2 , , T X , ' E ' , 5 X , ' S ' , 5 X , ' A L F A ' , X 6 X , ' B E T A • , 6 X , ' G A M M A ' , 2 X X , 2 X , • E N V » , 2 X , ' E N V ' • • , 2 X , • Z 1 • , 2 X , ' Z 1 • ' • , 3 X , • Z 2 ' , 4 X , ' Z 2 " ' ) D O 4 0 1 = 1 , 1 3 I F ( B A D ( I ) ) G 0 T O 4 0 S Q E = D S Q R T ( E ( I ) ) C A L L P A G E (1 ) F I = F L 0 A T ( 1 - 7 ) * 1 0 . C T A = B E T A { I ) * G A M M A ( I ) - A L F A ( I ) * A L F A ( I ) - 1 . 0 C I F ( D A B S ( T A ) . L T . 0 . 0 0 0 1 ) G 0 T O 2 3 6 C C A L L P A G E ( l ) C W R I T E ( 6 , 6 6 7 ) T A C 6 6 7 F 0 R M A T ( • * * * * * * * W A R N I N G * * * * * * * B E T A * G A M M A - A L F A * * 2 - 1 N O T Z E R O * C X , ' V A L U E = ' , E 1 6 . 8 ) 2 3 6 I F ( B E T A ( I ) . L T . 0 . 0 . O R . G A M M A ( I ) . L T . O . O G O T O 5 0 0 1 0 0 F O R M A T ( 1 X , F 4 . 0 , 1 X , F 6 . 1 , 4 E 1 1 . 3 , F 6 . 3 , F 6 . 2 , 3 E 1 0 . 3 , 6 F 5 . 2 ) E X = D S Q R T ( E P S * B E T A ( I ) ) E X P = D S Q R T ( E P S * G A M M A ( I ) ) / S Q E GO T O 6 0 0 5 0 0 E X = 0 . 0 E X P = 0 . 0 6 0 0 Z P A = T ( 1 , 1 , I ) * Z 1 ( I ) + T ( 1 , 2 , I ) * Z 1 P ( I ) Z P B = ( T ( 2 , 1 , I ) * Z 1 ( I ) + T ( 2 , 2 , I ) * Z 1 P ( I ) ) / S Q E Z Q A = T ( 1 , 1 , I ) * Z 2 ( I ) + T ( 1 , 2 , I ) * Z 2 P ( I ) Z Q B = ( T ( 2 , 1 , I ) * Z 2 ( I ) + T ( 2 , 2 , I ) * Z 2 P ( I ) ) / S Q E P S E = A M 0 D ( P A S E ( I ) * 5 7 . 2 9 5 8 , 3 6 0 . ) W R I T E ( 6 , 1 0 0 ) F I , P S E , T ( 1 , 1 , I ) , T ( 1 , 2 , I ) , X T ( 2 , 1 , I ) , T ( 2 , 2 , I ) , E ( I ) , S ( I ) , A L F A ( I ) , B E T A ( I ) , G A M M A ( I ) X , E X , E X P , Z P A , Z P B , Z Q A , Z Q B 4 0 C O N T I N U E R E T U R N E N D S U B R O U T I N E C O M P C O* O* O* O* O* O* O* O*. O* O* Of O* O* *•** "-'f *** *•'* *** >** *•* o* O* O* O* O* O* O* O* O* O* O* O* O* O* O* O* O* OL* o* o * o * o> o* o * O* O* O* O* O* O* O* O* O* O* O* /"* f~l Kll n •T"^ *r •'i* JP T> -V - r V -p *•.*• *y V *p --p -t*- -p -"p -r> -i*- n- -p - r - 1 - *p 'p -p -P -p - i - 3P -p *r 'p V * r *r- 'p ^ 'p -p ^ or- -v- -I" -P T- -P -P T» 'P ^ (J |v| r C - T H I S R O U T I N E S E T S U P T H E C A L L S T O S U B R O U T I N E R E G I O N W H I C H C C A L C U L A T E S T H E E L L I P S E O V E R L A P S C O M M O N / S T A R T / E S T A R T , Z 1 ( 1 3 ) , Z I P ( 1 3 ) , Z 2 ( 1 3 ) , Z 2 P ( 1 3 ) , E P S , E M A X C O M M O N / E L L I P S / A L F A ( 1 3 ) , B E T A ( 1 3 ) , G A M M A ( 1 3 ) C O M M O N / D I R / B K W D , E N D ( 1 3 ) , B A D ( 1 3 ) L O G I C A L B K W D , E N D , B A D D O U B L E P R E C I S I O N A L F A , B E T A , G A M M A D I M E N S I O N A ( 1 3 ) , V A L U E ( 1 3 , 1 3 ) , S U M ( 1 3 ) C A L L P A G E ( 1 8 ) 2 0 8 W R I T E ( 6 , 1 0 2 ) 1 0 2 F O R M A T ( ' O F R A C T I O N A L O V E R L A P O F E L L I P S E S ' ) W R I T E ( 6 , 1 0 0 ) 1 0 0 F O R M A T ( ' 0 • , 6 X , • - 6 0 - 5 0 • X , ' - 4 0 - 3 0 - 2 0 - 1 0 ' X ' 0 1 0 2 0 ' X , » 3 0 4 0 5 0 6 0 ' ) D O 1 1 = 1 , 1 3 N = ( 1 - 7 ) * 1 0 D O 2 J = 1 , I A ( J ) = 9 9 . I F ( B A D ( J ) . O R . B A D ( I ) ) G O T O 5 9 C A L L R E G I O N ( I , J , A ( J ) ) 5 9 C O N T I N U E V A L U E ( I , J ) = A ( J ) C W R I T E ( 2 , 5 4 9 ) A ( J ) C 5 4 9 F O R M A T ( • ' , G 1 6 . 8 ) J J = J 2 C O N T I N U E W R I T E ( 6 , 1 0 1 ) N , ( A ( K ) , K = 1 , J J ) 1 0 1 F O R M A T ( • • , I 4 , 1 3 ( 2 X , F 5 . 3 , 2 X ) ) 1 C O N T I N U E D O 8 1 = 1 , 1 3 J J = I S U M ( I ) = - l . 0 D O 6 2 J = 1 , J J 6 2 I F ( V A L U E ( I , J ) . L E . 1 . 0 ) S U M ( I ) = S U M ( I ) + V A L U E ! I , J ) D O 1 1 K = J J , 1 3 11 I F ( V A L U E ( K , J J ) . L E . 1 . 0 ) S U M ( I ) = S U M ( I ) + V A L U E ( K , J J ) 8 C O N T I N U E DO 9 1 = 1 , 1 3 S U M ( I ) = S U M ( I ) / 1 3 . I F ( S U M ( I ) . L T . O . O ) S U M ( I ) = 9 9 . 9 C O N T I N U E W R I T E ( 6 , 1 0 3 ) S U M 1 0 3 F O R M A T ( * S U M • , 1 3 ( 2 X , F 5 . 3 , 2 X ) ) R E T U R N E N D S U B R O U T I N E R E G I O N ( I , J , F R A C ) Q l^ C >)C >^C >p" i [ ' 2p ° p I O N C S U B R O U T I N E R E G I O N C A L C U L A T E S F R A C T I O N A L O V E R L A P O F E L L I P S E S C O M M O N / S T A R T / E S T A R T , Z 1 ( 1 3 ) , Z 1 P ( 1 3 ) , Z 2 ( 1 3 ) , Z 2 P ( 1 3 ) , E E , E M A X C O M M O N / T T / T ( 2 , 2 , 1 3 ) , E A B ( 1 3 ) , S ( 1 3 ) , P A S E ( 1 3 ) D O U B L E P R E C I S I O N T , E A B C O M M O N / E L L I P S / A L F A ( 1 3 ) , B E T A ( 1 3 ) , G A M M A ( 1 3 ) D O U B L E P R E C I S I O N A L F A , B E T A , G A M M A , A 1 , B 1 , G 1 , A 2 , B 2 , G 2 , E D O U B L E P R E C I S I O N S U M 1 , S U M 2 , D I F F 1 , D I F F 2 , R A T I 0 1 , R A T 1 0 2 D O U B L E P R E C I S I O N A , B , G , B I N V , D I S C R , S T U F F 1 , S T l J F F 2 , X 1 , X 2 , T E M P D O U B L E P R E C I S I O N P S I P O S , P S I N E G , H 1 , H 2 , B A S I C 1 , B A S I C 2 , C H 1 1 , C H 1 2 D O U B L E P R E C I S I O N D P 1 , D P 2 , D N 1 , D N 2 , T P L U S , T M I N U S , F I P O S , F I N E G S Q E I = D S Q R T ( E A B ( I ) ) S Q E J = D S Q R T ( E A B ( J ) ) A 1 = A L F A ( I ) A 2 = A L F A ( J ) B 1 = B E T A ( I ) * S Q E I B 2 = B E T A ( J ) * S Q E J G 1 = G A M M A ( I ) / S Q E I G 2 = G A M M A ( J ) / S Q E J E = E E L O G I C A L L I , L 2 , L 3 , L L 1 , L L 2 R E A L * 8 M A J 1 , M A J 2 , M I N 1 , M I N 2 , M A J D I F S U M 1 = G 1 + B 1 S U M 2 = G 2 + B 2 D I F F 1 = G 1 - B 1 D I F F 2 = G 2 - B 2 R A T I 0 1 = 0 . 5 * ( S U M 1 + D S Q R T ( S U M l * S U M l - 4 . ) ) R A T I 0 2 = 0 . 5 * ( S U M 2 + D S Q R T ( S U M 2 * S U M 2 - 4 . ) ) M A J l = D S O R T ( E * R A T I 0 1 ) M A J 2 = D S Q R T ( E * R A T I 0 2 ) A = A 1 - A 2 B = B 1 - B 2 G = G 1 - G 2 L l = A . E Q . O . . A N D . B . E Q . O . L 2 = A . E Q . O . . A N D . G . E Q . O . L 3 = B . E Q . O . . A N D . G . E Q . O . C T H E E L L I P S E S C O I N C I D E I F ( L 1 . 0 R . L 2 . 0 R . ( L 1 . A N D . L 2 ) ) G O T O 6 2 1 C P O I N T S O F I N T E R S E C T I O N A R E A T 0 A N D 9 0 D E G R E E S I F ( L 3 ) G O T O 6 2 2 C O N E P O I N T O F I N T E R S E C T I O N I S A T 9 0 D E G R E E S I F ( B . E Q . O . . A N D . G . N E . O . ) GO T O 6 2 3 C N O N E O F T H E A B O V E S P E C I A L C A S E S C C A L C U L A T E A N G L E S O F I N T E R S E C T I O N B I N V = 1 . / B D I S C R = D S Q R T ( A * A - B * G ) S T U F F 1 = - B I N V * A S T U F F 2 = B I N V * D I S C R X 1 = S T U F F 1 + S T U F F 2 X 2 = S T U F F 1 - S T U F F 2 I F ( 6 . G T . 0 . ) G O T O 6 2 4 T E M P = X 2 X 2 = X1 X 1 = T E M P 6 2 4 P S I P O S = D A T A N ( X I ) P S I N E G = D A T A N ( X 2 ) G O T O 6 8 6 6 2 3 P S I P 0 S = 1 . 5 7 0 7 9 6 3 P S I N E G = 0 . 5 * G / A G O T O 5 0 0 6 2 2 P S I P 0 S = 1 . 5 7 0 7 9 6 3 P S I N E G = 0 . C C A L C U L A T E O R I E N T A T I O N S O F M A J O R A X E S C T E S T T O S E E I F E L L I P S E #1 I S A C I R C L E 6 8 6 I F ( D I F F 1 . E Q . O . O ) G O T O 4 0 0 5 0 0 H 1 = 2 . * A 1 / D I F F 1 B A S I C 1 = 0 . 5 * D A T A N ( H 1 ) I F ( D I F F 1 . L T . O . ) G 0 T O 5 0 3 I F ( A l ) 5 0 1 , 5 0 2 , 5 0 2 5 0 1 C H I 1 = B A S I C 1 + 1 . 5 7 0 7 9 6 3 GO T O 6 8 7 5 0 2 C H I 1 = B A S I C 1 - 1 . 5 7 0 7 9 6 3 GO T O 6 8 7 5 0 3 C H I 1 = B A S I C 1 GO T O 6 8 7 4 0 0 C H I 1 = 0 . C T E S T T O S E E I F E L L I P S E #2 I S A C I R C L E 6 8 7 I F ( D I F F 2 . E Q . 0 . 0 ) G 0 T O 4 0 1 H 2 = 2 . * A 2 / D I F F 2 5 0 4 B A S I C 2 = 0 . 5 * D A T A N ( H 2 ) I F ( D I F F 2 . E Q . O . ) G 0 T O 4 0 1 I F ( D I F F 2 . L T . 0 . ) G 0 T O 5 0 7 I F ( A 2 ) 5 0 5 , 5 0 6 , 5 0 6 5 0 5 C H I 2 = B A S I C 2 + 1 . 5 7 0 7 9 6 3 G O T O 5 0 8 5 0 6 C H I 2 = B A S I C 2 - 1 . 5 7 0 7 9 6 3 G O T O 5 0 8 5 0 7 C H I 2 = B A S I C 2 G O T O 5 0 8 4 0 1 C H I 2 = 0 . C T H E R E A R E 3 P O S S I B L E C A S E S : C ( 1 ) O N E M A J O R A X I S L I E S O U T S I D E P T S . O F I N T E R S E C T I O N C ( 2 ) B O T H A X E S L I E I N S I D E C ( 3 ) B O T H A X E S L I E O U T S I D E 5 0 8 D P 1 = P S I P 0 S - C H I 1 D P 2 = P S I P 0 S - C H I 2 D N 1 = P S I N E G - C H I 1 D N 2 = P S I N E G - C H I 2 L L 1 = D N 1 . L E . 0 . . A N D . D P 1 . G E . 0 . L L 2 = D N 2 . L E . 0 . . A N D . D P 2 . G E . 0 . C T E S T C A S E ( 2 ) I F ( L L I . A N D . L L 2 ) G O T O 5 1 1 C T E S T C A S E ( 3 ) I F ( . N 0 T . L L 1 . A N D . . N 0 T . L L 2 ) G O T O 5 1 2 C C A S E ( 1 ) I F ( L L 1 . A N D . . N 0 T . L L 2 ) GO T O 5 0 9 I F ( . N O T . L L I . A N D . L L 2 ) G O T O 5 1 0 C M O R E C A L C U L A T I O N A N D T E S T I N G R E Q U I R E D T O D E T E R M I N E C W H I C H E L L I P S E T O U S E F O R A R E A S E C T O R C A L C U L A T I O N 5 0 9 T P L U S = D S I N ( D P 2 ) / D C O S ( D P 2 ) T M I N U S = D S I N ( D N 2 ) / D C O S ( D N 2 ) GO T O 5 1 3 5 1 0 T P L U S = D S I N ( D P I ) / D C O S ( D P I ) T M I N U S = D S I N ( D N 1 ) / D C O S ( D N 1 ) G O T O 5 1 4 5 1 1 M A J D I F = M A J 1 - M A J 2 I F ( M A J D I F ) 5 1 0 , 5 1 0 , 5 0 9 5 1 2 M A J D I F = M A J 1 - M A J 2 I F ( M A J D I F ) 5 0 9 , 5 0 9 , 5 1 0 5 1 3 F I P 0 S = D A T A N ( R A T I 0 2 * T P L U S ) I F ( D P 2 . G E . - 1 . 5 7 0 7 9 6 3 . A N D . D P 2 . L E . 1 . 5 7 0 7 9 6 3 ) G 0 T O 4 0 2 F I P O S = F I P O S + 3 . 1 4 1 5 9 2 7 4 0 2 F I N E G = D A T A N ( R A T I 0 2 * T M I N U S ) I F ( D N 2 . G E . - 1 . 5 7 0 7 9 6 3 . A N D . D N 2 . L E . 1 . 5 7 0 7 9 6 3 ) G O T O 4 5 0 F I N E G = F I N E G + 3 . 1 4 1 5 9 2 7 GO T O 4 5 0 5 1 4 F I P 0 S = D A T A N ( R A T I 0 1 * T P L U S ) I F ( D P 1 . G E . - 1 . 5 7 0 7 9 6 3 . A N D . D P I . L E . 1 . 5 7 0 7 9 6 3 ) G O T O 4 0 3 F I P 0 S = F I P 0 S + 3 . 1 4 1 5 9 2 7 4 0 3 F I N E G = D A T A N ( R A T I 0 1 * T M I N U S ) I F ( D N 1 . G E . - 1 . 5 7 0 7 9 6 3 . A N D . D N 1 . L E . 1 . 5 7 0 7 9 6 3 ) G 0 T O 4 5 0 F I N E G - F I N E G + 3 . 1 4 1 5 9 2 7 G O T O 4 5 0 6 2 1 F R A C = 1 . 0 G O T O 7 0 0 4 5 0 F R A C = ( 2 . / 3 . 1 4 1 5 9 2 7 ) * ( F I P O S - F I N E G ) 7 0 0 C O N T I N U E R E T U R N E N D S U B R O U T I N E P A G E ( N R E Q D ) '• 21 1 C x i * x l * xV x*V x»* x l * x l * x l * x l * x l * x l * x l * x l * x>* x l * x»* x l * x l * x l * x l * x l * x l * x»* x l * x l * x l * x l * x l * x l * x l * x l * x l * x l * xx* x l * x l * x l * X 1 ' x>* >•* x>* x l * x l * v>* x l * x l * xl* x l * x l * x»- x>* x l * x<* x l * x l * x l * r~) A /*" d ' r ^» ^ ^ T - ^ ^ V V ^ Y 'i'* - Y - ' i * ' r ' f - ' i - ' i * •"i -"- 'Vs - " i - *i» *i« - Y - *p *»N *p o* o^ o^ o v O ^ ^ O ^ "V- - V " -f IS- ' r -v- '»'•' - Y " "»% ' i v r A u L C - T H I S R O U T I N E W R I T E S T H E T I T L E C P A G E N U M B E R ON E A C H N E W P A G E C O M M O N / P G E / N , N P A G E , N A M E ( 5 ) C O M M O N / S T A R T / E S T A R T , Z 1 ( 1 3 ) , Z 1 P ( 1 3 ) , Z 2 ( 1 3 ) , Z 2 P ( 1 3 ) , E P S » E M A X C O M M O N / S T A R T 2 / F I O , D E L T A , C , T H T A D I M E N S I O N D ( 2 ) , T ( 2 ) I F ( N + N R E Q D . G T . 6 0 ) G O T O 1 N = N + N R E Q D R E T U R N 1 N P A G E = N P A G E + 1 C A L L D A T E ( D » T ) D Z A = D E L T A * 5 7 . 2 9 5 7 8 W R I T E ( 6 , 1 0 1 ) N A M E , C , D Z A , D , T , N P A G E 1 0 1 F O R M A T ( • 1 C A S E ' , 5 A 4 , 3 X , ' C = 1 X , F 7 . 3 , 3 X , ' D E L T A = • X , F 7 . 3 , 3 X , 2 A 4 , 2 X , 2 A 4 , 4 2 X , ' P A G E • , 1 3 / / ) N = 4 + N R E Q D I F ( N R E Q D . E Q . 6 1 ) N = 4 R E T U R N E N D S U B R O U T I N E P O I N T S C W R I T E ( 5 , 9 ) C 9 F O R M A T ( • ' , ' P O I N T S C A L L E D ' ) D I M E N S I O N C ( 1 3 ) , Q ( 1 3 ) C O M M O N / P T S / X ( 1 3 , 2 0 0 ) , Y ( 3 , 1 3 , 2 0 0 ) , P H ( 1 3 ) , M , T U R N S C O M M O N / S T A R T / E S T A R T , Z 1 ( 1 3 ) , Z 1 P ( 1 3 ) , Z 2 ( 1 3 ) , Z 2 P ( 1 3 ) , E P S , E M A X D O U B L E P R E C I S I O N A L F A , B E T A , G A M M A , T , E C O M M O N / T T / T ( 2 , 2 , 1 3 ) , E ( 1 3 ) , S ( 1 3 ) C O M M O N / E L L I P S / A L F A ( 1 3 ) , B E T A ( 1 3 ) , G A M M A ( 1 3 ) C O M M O N / S T A R T 2 / F 1 0 , D E L T A , C D U M , T H T A C O M M O N / S Q A L E / X S K A L , Y S K A L D A T A A , B / . 0 1 7 4 5 3 2 9 , . 0 3 1 8 3 0 9 8 / C W R I T E ( 5 , 1 0 ) ( B E T A ( I ) , I = 1 , 1 3 ) , ( T ( 1 , 1 , I ) , T ( 1 , 2 , I ) , T ( 2 , 1 , I ) , C 2 T ( 2 , 2 , I ) , 1 = 1 , 1 3 ) , T H T A C 1 0 F O R M A T ( I X , 1 0 E 1 3 . 6 ) D O 2 0 0 1 = 1 , 1 3 C I F ( I . E Q . l ) W R I T E ( 5 , 15 ) C 1 5 F O R M A T ( ' 0 • , T 1 0 , ' I • , T 3 0 , ' P H I ' , T 5 0 , ' C , / / ) P H ( I ) = 1 0 . * ( 1 - 6 ) C ( I ) = C O S ( P H ( I ) * A ) * B C W R I T E ( 5 , 2 0 ) I , P H ( I ) , C ( I ) C 2 0 F O R M A T ( ' ' , T 9 , 1 2 , T 2 7 , F 6 . 1 , T 4 6 , F 1 0 . 6 ) 2 0 0 C O N T I N U E J = l R E T U R N E N T R Y P O I N T Q 3 0 0 D O 4 0 0 1 = 1 , 1 3 C I F ( I . E Q . 1 ) W R I T E ( 5 , 4 0 ) J C 4 0 F O R M A T ( ' 0 • , T 3 0 , * J = ' , 1 4 , / / ) C I F ( I . E Q . l ) W R I T E ( 5 , 3 0 ) C 3 0 F O R M A T ( ' • , T 2 0 , » Y 1 • , T 4 0 , • Y 2 ' , T 6 0 , ' Y 3 • , T 8 0 , • X ' , / / ) Y ( 1 ,1 , J ) = ( T ( 1 , 1 , I ) * Z 1 ( I ) + T ( 1 , 2 , 1 ) * Z 1 P ( I ) ) / Y S K A L + 5 . Y ( 2 , I , J ) = ( T ( 1 , 1 , I ) * Z 2 ( I ) + T ( 1 , 2 , I ) * Z 2 P ( I ) ) / Y S K A L + 5 . Y ( 3 , I , J ) = ( D S Q R T ( E P S * B E T A ( I ) ) ) / Y S K A L + 5 . X ( I , J ) = T H T A * C ( I ) / X S K A L C W R I T E ( 8 , 3 5 ) Y ( 1 , I , J ) , Y ( 2 , I , J ) , Y ( 3 , I , J ) , X ( I , J ) C 3 5 F O R M A T ( ' » , 4 F 1 0 . 4 ) 4 0 0 C O N T I N U E M = J .- 21 2 J = J + 1 R E T U R N E N D S U B R O U T I N E P L O ( L Z 1 , L Z 2 , L E N V , L A L L , I S T , L A S T ) C Ox Ox Ox »ix O/ vi/ %i/ . i / ^ ^ Ox J/."-\V Ox vi , vt- s i - O / v1- >!- J< x^ »v V' -Jf •-' ~'x ° ' Ox Ox vt« V' ^  ^  *-'' *-V Ox o . Ox J- n i f l •v» or or- o* or or *Y" or * ^ *r* ^ or* *»*• or** "V -"r- O"* -T* •*!- i 5 , O - or* or* *v or* or* or* O" •¥* ' n O"* *f- "•** o"> O-* • V ' * Y * *r* **r* *¥* 'r- 'r* *v -y- 'v» -r^ - v -i->- -i*- -p. xp x .^ -p. xp xx- xp xp xp ^ C C T H I S S U B R O U T I N E D R A W S A X E S A N D L A B E L S A N D D E C I D E S C W H I C H P H A S E S A R E T O B E P L O T T E D C C W R I T E ( 5 , 2 5 ) C 2 5 F O R M A T ( ' ' , ' P L O H A S B E E N C A L L E D ' / / ) I N T E G E R 1 S T , L A S T , M , P N C O M M O N / P L T / I S , P R N T C O M M O N / U S D / U S E D C O M M O N / P T S / X ( 1 3 , 2 0 0 ) , Y ( 3 , 1 3 , 2 0 0 ) , P H ( 1 3 ) , M , T U R N S C O M M O N / P G E / N , N P A G E , N A M E ( 5 ) C O M M O N / S Q A L E / X S K A L E , Y S K A L E C O M M O N / D I R / B K W D , E N D ( 1 3 ) , B A D ( 1 3 ) L O G I C A L B K W D , E N D , B A D L O G I C A L L Z 1 , L Z 2 , L E N V , L A L L , L P N , I S , P R N T T U R N S = M / 6 T U R N S = T U R N S / X S K A L E H A L F = T U R N S / 2 . C W R I T E ( 5 , 1 0 5 ) T U R N S , H A L F C I O 5 F O R M A T ) « 0 ' , T 3 0 , • T U R N S = ' , F 1 0 . 5 , T 5 0 , • H A L F = ' , F 1 0 . 5 , / / ) I F ( I S ) G O T O 1 0 C A L L P L O T S I S = . T R U E . 1 0 C A L L P L O T ( U S E D , 0 . 0 , - 1 ) Y S T T = - 5 . * Y S K A L E C A L L A X I S ( 0 . , 0 . , ' Z ' , 1 , 1 0 . , 9 0 . , Y S T T , Y S K A L E ) C A L L A X I S ( 0 . , 5 . , ' T U R N S X C O S ( P H A S E ) ' , - 1 8 , T U R N S , 0 . , 0 . 0 , X S K A L E ) C A L L S Y M B O L ( H A L F - 1 . 8 , 9 . , . 2 1 , N A M E ( 1 ) , 0 . , 2 0 ) I F ( . N O T . L Z 1 ) G O T O 2 0 0 C A L L S Y M B O L ( H A L F - . 9 , 8 . 7 5 , . 2 1 , ' Z 1 ' , 0 . , 2 ) D O 1 2 0 1 = 1 , 1 3 P N = P H ( I ) L P N = ( P N . L T . I S T ) . O R . ( P N . G T . L A S T ) I F ( L P N . A N D . . N O T . L A L L ) G O T O 1 2 0 I F ( B A D ( I ) ) G O T O 1 2 0 C A L L D P ( 1 , I ) 1 2 0 C O N T I N U E 2 0 0 I F ( . N 0 T . L Z 2 ) G O T O 3 0 0 C A L L S Y M B O L ( H A L F - . 3 6 , 8 . 7 5 , . 2 1 , ' Z 2 ' , 0 . , 2 ) D O 2 2 0 1 = 1 , 1 3 P N = P H ( I ) L P N = ( P N . L T . 1 S T ) . O R . ( P N . G T . L A S T ) I F ( L P N . A N D . . N O T . L A L L ) G O T O 2 2 0 I F ( B A D ( I ) ) G O T O 2 2 0 C A L L D P ( 2 , I ) 2 2 0 C O N T I N U E 3 0 0 I F ( . N O T . L E N V ) G O T O 4 0 0 C A L L S Y M B O L ( H A L F + . 1 8 , 8 . 7 5 , . 2 1 , ' E N V ' , 0 . , 3 ) D O 3 2 0 1 = 1 , 1 3 P N = P H ( I ) L P N = ( P N . L T . 1 S T ) . O R . ( P N . G T . L A S T ) I F ( L P N . A N D . . N O T . L A L L ) G O T O 3 2 0 I F ( B A D ( I ) ) G O T O 3 2 0 C A L L D P ( 3 , I ) 3 2 0 C O N T I N U E 4 0 0 ' I F { L A L L ) G 0 T O 5 0 0 C A L L S Y M B O L ( H A L F - 1 . 9 8 , 8 . 5 , . 2 1 , ' P H A S E S T O I N C L ' , 1 0 . , 2 2 ) F L T 1 = I S T F L T 2 = L A S T C A L L N U M B E R ( H A L F - . 7 2 , 8 . 5 , . 2 1 , F L T 1 , 0 . , - 1 ) C A L L N U M B E R ( H A L F + . 5 4 , 8 . 5 , . 2 1 , F L T 2 , 0 . , - 1 ) 5 0 0 C O N T I N U E C A L L W H E R E ( X N O W , Y N O W ) C A L L P L O T ( X N 0 W , Y N 0 W , 3 ) U S E D = T U R N S + 2 . R E T U R N E N D S U B R O U T I N E D P ( N , K ) /"* J * -Jr >«» O* -JO - J * - J * >V «JU- JL- «J"-- •»».• xO N O «X- «J* • J ' *V -»V V V V* «•** %V •»** •»** V* »*» ****** xt* «Jt* O* *t* *V *** J * >•*•*** *st •** *•*» O* *** P\ D ^ * , » * , » * p * v » * ^ * , r * p * ^ * ^ * r * * T i * 0 * r * p C C T H I S S U B R O U T I N E D R A W S T H E L I N E S C C O M M O N / P T S / X ( 1 3 , 2 0 0 ) , Y ( 3 , 1 3 , 2 0 0 ) , P H ( 1 3 ) , M , T U R N S I N T E G E R P , K , N , M L O G I C A L L Y B , L Y S , L X B , L M 0 D , 0 N 6 6 6 C O N T I N U E D I M E N S I O N V ( 2 0 0 ) , W ( 2 0 0 ) C V I S X - C O O R D . W I S Y - C O O R D . C W R I T E ( 5 , 1 1 5 ) N , K C 1 1 5 F O R M A T ( ' 0 ' , T 2 0 , ' D P C A L L E D ' , T 3 0 , ' N = ' , I 2 , T 4 0 , • K = ' , 1 2 , / / ) C A L L Q P R S ( P , 0 N ) D O 1 0 0 J = 1 , M C I F ( J . E Q . l ) W R I T E ( 5 , 5 0 ) C 5 0 F O R M A T ( ' 0 • , T 1 0 , ' J • , T 2 5 , ' V ( J ) ' , T 4 5 , » W ( J ) ' , / / ) C W R I T E ( 5 , 1 3 5 ) J , V ( J ) , W ( J ) C 1 3 5 F O R M A T ( • • , T 8 , I 4 , T 2 0 , F 1 0 . 6 , T 4 0 , F 1 0 . 6 ) L Y B = ( Y ( N , K , J ) . L T . 1 0 . ) L Y S = ( Y ( N , K , J ) . G T . O . ) L X B = ( X ( K , J ) . L T . T U R N S ) L M 0 D = ( M 0 D ( J , 2 4 ) . E Q . 0 ) I F ( L Y B . A N D . L Y S . A N D . L X B . A N D . L M O D ) C A L L N U M B E R < V ( J ) , W ( J ) , 1 . 1 , P H ( K ) , 0 . , - 1 ) I F ( L Y B . A N D . L Y S ) GO T O 1 2 0 I F ( L Y S ) GO T O 1 1 0 C Y T O O S M A L L S T O P L I N E A T B O T T O M O F P A G E C A L L O P Q ( O N , N , K , £ 1 0 0 , < S 1 3 0 , £ 1 2 1 ) 1 2 1 P = P + 1 V ( P ) = ( X ( K , J ) - X ( K , J - 1 ) ) * Y ( N , K , J - 1 ) / ( Y ( N , K , J - 1 ) - Y ( N , K , J ) ) + X ( K , J - 1 ) W ( P ) = 0 . C W R I T E ( 5 , 6 5 ) C 6 5 F O R M A T ( ' ' , ' L A S T Y T O O S M A L L ' , T 2 0 , • N E W X = » , F 1 0 . 5 , C 2 T 4 0 , « N E W Y = ' , F 1 0 . 5 ) C A L L N U M B E R ( V ( P ) , W ( P ) , . 2 , P H ( K ) , 0 . , - 1 ) G O T O 1 0 0 C Y I S T O O B I G . S T O P L I N E A T T O P O F P A G E 1 1 0 C A L L 0 P Q ( 0 N , N , K , £ 1 0 0 , £ 1 3 0 , £ 1 2 2 ) 1 2 2 P = P + 1 V ( P ) = ( X ( K , J ) - X ( K , J - 1 ) ) * ( 1 0 . - Y ( N , K , J - 1 ) ) / ( Y ( N , K , J ) - Y ( N , K , J - l ) ) X + X ( K , J - 1 ) W ( P ) = 1 0 . C W R I T E ( 5 , 9 5 ) V ( J ) , W ( J ) C 9 5 F O R M A T ( ' ' , ' L A S T Y T O O B I G ' , T 2 0 , • N E W X = • , F 1 0 . 5 , C 3 T 4 0 , « N E W Y = ' , F 1 0 . 5 ) C A L L N U M B E R ( V ( P ) + . 0 1 , W ( P ) - . 0 5 , . 1 , P H ( K ) , 0 . , - 1 ) 1 2 0 C G O T O 1 0 0 I F ( L X B ) G O T O 9 9 X I S T O O B I G S T O P L I N E A T E N D O F X - A X I S C A L L O P Q ( O N , N , K , 8 1 0 0 , £ 1 3 0 , £ 1 2 3 ) 1 2 3 P = P + 1 W ( P ) = ( Y ( N , K , J ) - Y ( N , K , J - 1 ) ) * ( T U R N S - X ( K , J - l ) ) / ( X ( K , J ) - X ( K , J - l ) ) X + Y ( N , K , J - 1 ) V ( P ) = T U R N S C W R I T E ( 5 , 6 0 ) V ( J ) , W ( J ) C 6 0 F O R M A T ( 1 ' , ' L A S T X T O O B I G • , T 2 0 , ' N E W X = • , F 1 0 . 5 , C 4 T 4 0 , ' N E W Y = ' , F 1 0 . 5 ) C A L L N U M B E R ( V ( P ) + . 0 1 , W ( P ) - . 0 5 , . 1 , P H ( K ) , 0 . , - 1 ) G O T O 1 0 0 9 9 P = P + 1 V ( P ) =X (K , J ) W ( P ) = Y ( N , K , J ) O N = . T R U E . 1 0 0 C O N T I N U E 1 3 0 W R I T E ( 8 , 6 6 9 ) ( V ( N M ) , W ( N M ) , N M = 1 , P ) 6 6 9 F O R M A T ( « ' , 2 G 1 2 . 3 ) C A L L L I N E ( V , W , P , 1 ) C W R I T E ( 5 , 1 2 5 ) N , K , P C 1 2 5 F O R M A T ( ' 0 ' , T 2 0 , ' L I N E C A L L E D F O R N = • , I 2 , 2 X , • K = • , 1 2 , 2 X , ' P = ' , 1 4 , C 5 T 6 0 , ' R E T U R N T O P L O • ) 6 6 7 C O N T I N U E R E T U R N E N D S U B R O U T I N E 0 P Q ( O N , N , K ) L O G I C A L 0 F F ( 1 3 ) , 0 N I N T E G E R P I F ( . N O T . O N ) R E T U R N 1 0 N = . F A L S E . I F ( O F F ( K ) ) R E T U R N 2 O F F ( K ) = . T R U E . R E T U R N 3 E N T R Y O P R S ( P , O N ) D O 1 1 = 1 , 1 3 1 O F F ( I ) = . F A L S E . 0 N = . F A L S E . P = 0 R E T U R N E N D S U B R O U T I N E D A T A ( * ) C O M M O N / C A R D / P ( 8 ) , M N T ( 5 ) D I M E N S I O N A ( 4 0 ) R E A D 1 0 0 , A , M N T 1 0 0 F O R M A T ( 4 0 A 1 , 5 A 4 ) P R I N T 1 0 1 , A , M N T 1 0 1 F O R M A T ( 6 H 0 D A T A / 4 0 A 1 , I H / 5 A 4 , I H / ) D O 1 5 1 = 1 , 8 1 5 P ( I ) = 0 . C A L L S C A N ( A , 4 0 , P , 8 ) C A L L C L 0 C K ( $ 9 9 9 ) R E T U R N 9 9 9 R E T U R N 1 E N D S U B R O U T I N E S C A N ( A , N C H , T , M A X ) D I M E N S I O N A ( 1 ) , T ( 1 ) , C ( 1 2 ) L O G I C A L M I N U S , N U M B E R , P E R I O D , F R A C T , O P E N * * O P Q '215 DATA C / 1 H 0 , 1 H 1 , 1 H 2 , 1 H 3 , 1 H 4 , 1 H 5 , 1 H 6 , 1 H 7 , 1 H 8 t 1 H 9 , I H . , 1 H - / K = 0 NFPT=0 4 CONT INUE OPEN=.FALSE. FRACT=.FALSE. MINUS=.FALSE. FPNINT=0. FPNFRC=0 . N FRACT=0 SGN=1. 5 K=K+1 IF(K.GT.NCH.OR.NFPT.GT.MAX)RETURN CH=A (K ) DO 10 1=1,12 IF(C ( I ) .EQ.CH.GO TO 15 10 CONTINUE IF(OPEN)GO TO 20 GO TO 5 15 PERIOD=I .EQ. l l MINUS=I.EQ.12 NUMBER=I .LT . l l OPEN=.TRUE. IF(PERIOD)FRACT=.TRUE. IF(FRACT)NFRACT=NFRACT+1 IF(MINUS)SGN=-1. FPT=I-1 IF(NUMBER.AND.FRACT)FPNFRC=FPNFRC+FPT/FLOAT(10**(NFRACT-1)) IF(NUMBER.AND..NOT.FRACT)FPNINT = FPNI NT*10.+ FPT GO TO 5 20 NF PT = NF PT + 1 T(NFPT)=SGN*(FPNINT+FPNFRC) GO TO 4 END FUNCTION UTERP(E) COMMON /VNUZ/NNUZ,EOZ,DELEZ,UZ( 100) P=(E-EOZ)/DELEZ IT = P P=P-IT IT=IT+1 P2=P+P P3=P2+P PP=P*P UTE RP=(P P—P3 +2. )*UZ(IT)/2. + (P2-PP)*UZ(IT+1)+(PP-P)*UZ( IT+2)/2. UTERP=ABS(UTERP) RETURN END FUNCTION STERP(E) COMMON /SLIP/NPS,EOS,DELES,PS(100) P=(E-EOS)/DELES IT = P P = P- IT IT= IT + 1 P2=P+P P3=P2+P PP=P*P STERP=(PP-P3+2.)*PS( IT)/2.+(P2-PP)*PS( IT+1)+(PP-P)*PS( IT+2)/2. RETURN END 

Cite

Citation Scheme:

        

Citations by CSL (citeproc-js)

Usage Statistics

Share

Embed

Customize your widget with the following options, then copy and paste the code below into the HTML of your page to embed this item in your website.
                        
                            <div id="ubcOpenCollectionsWidgetDisplay">
                            <script id="ubcOpenCollectionsWidget"
                            src="{[{embed.src}]}"
                            data-item="{[{embed.item}]}"
                            data-collection="{[{embed.collection}]}"
                            data-metadata="{[{embed.showMetadata}]}"
                            data-width="{[{embed.width}]}"
                            async >
                            </script>
                            </div>
                        
                    
IIIF logo Our image viewer uses the IIIF 2.0 standard. To load this item in other compatible viewers, use this url:
http://iiif.library.ubc.ca/presentation/dsp.831.1-0084831/manifest

Comment

Related Items