New Electrostatic Element Procedures for COSY Infinity J.A. Maloney TRIUMF 1. Abstract COSY Infinity (COSY) [1] is a DA-based beam simulation code that allows calculation of transfer maps for beam optical systems to any arbitrary order. Presently, the current beam physics package for COSY (COSY.fox Version 9.1 – January 2013) approximates fringe fields for both electrostatic and magnetic beam elements using the same model. Also, although COSY allows simulation of elements from measured magnetic field data, it lacks similar functionality for electrostatic elements. New procedures have been developed for COSY that allow more accurate modelling of fringe fields for electrostatic elements and also for specifying an electrostatic element from measure data. 2. Introduction a. COSY Modelling of Electrostatic Elements COSY’s modelling of most elements is based on determination of fields and potentials in the beam line midplane. COSY uses a curvilinear coordinate system where s is the forward trajectory of the reference particle, and x and y represent the transverse horizontal and vertical dimensions, respectively. The plane defined by y=0 is in this coordinate system corresponds to the x-z plane in Cartesian coordinates. COSY simulations require a reference particle that has an orbit be confined to this plane. This condition (y=0) allows the LaPlacian to be expressed as: 1 π ππ 1 π 1 ππ π 2π βπ = ((1 + βπ₯) ) + ( )+ 2 1 + βπ₯ ππ₯ ππ₯ 1 + βπ₯ ππ 1 + βπ₯ ππ ππ¦ Where h is the momentary curvature. This allows the form of the potential to be expressed, and from this the electric and magnetic fields can be determined, using the midplane as a boundary condition. COSY then uses Maxwell’s equations to determine the potential and fields in all space via integration [2]. To specify electrostatic elements, COSY.fox defines either (1) the midplane electric field components, Ex and Ez, or (2) the electrostatic potential. For example, the potential of an infinity long electrostatic quadrupole in the midplane is π = (ππ ⁄π·⁄π·) ∗ π₯ 2 where V0 is the voltage at the poletip and D is the aperture (the distance from the optical axis to the poletip. Most electrostatic elements are specified in COSY via the potential in the midplane in this manner. Although useful, the analytic expressions for these elements are idealized. In practice, a “pure” quadrupole, for example, is at best an approximation. Additionally, these procedures assume that the reference orbit enters normal to the surface of the element and that it is centered along the element’s optical axis. Including misalignment errors is possible in COSY, but the problem is more pronounced with bending electrostatic elements. When deflected as it enters and exits a bending electrostatic dipole, particles feel a longitudinal electric field as well as the transverse component. COSY’s internal SA and TA procedures can be used to correct this in the case of a steering dipole. A more substantial issue arises in the case of bending elements. In the “no fringe field” case, a particle travel straight until in enters the element, then experiences a constant transverse bending force (Ex) due its electrostatic rigidity, and finally leaves via another straight path. This “hard edge” case is unfortunately not physical. The transverse fields will drop off at the entrance and exit of the element. As a reference particle enters the element through the fringe field region, it also experiences a longitudinal electric field (Ez) that accelerates the particle. This effect is balanced by a decelerating longitudinal electric field as the particle encounters the exit fringe field so that energy is conserved. Since, however, the bending orbit is based on particle momentum, this creates and issue for calculating the reference orbit. COSY approximates this by “jumping” back to the orbit after the entrance fringe field, and also before the exit fringe field by adjusting the local coordinates of the reference particle. This is a substantial source of error cause in the transfer map calculation. b. COSY Modelling of Fringe Fields In the current version of beam physics package for COSY Infinity (COSY.fox ver. 9.1 – January 2013), the modelling of fringe fields is accomplished by using an ENGE function of the form: π§ π§ 2 π§ 3 π§ 4 π§ 5 πΉ(π§) = πΉ0 / (1 + ππ₯π (π1 + π2 ( ) + π3 ( ) + π4 ( ) + π5 ( ) + π6 ( ) )) 2π· 2π· 2π· 2π· 2π· where πΉ0 is the field inside the element and D is the aperture (defined as the distance from the reference orbit to the poletip). Within COSY, default values are used for the coefficients of this ENGE function based on other magnetic systems. This values offer a good approximation of the field drop off before and after an element. In practice, however, the ENGE function may not always be sufficient. While the function can be matched to the drop off on one particle trajectory, it will not match for offset particle trajectories. These variation generally effect only higher order aberrations. [3] Unfortunately, COSY models these fields for electrostatic benders with the ENGE coefficients it has measured for the drop off of the field from a magnetic dipole. To obtain a more accurate model, it is possible to manual enter the ENGE coefficients into COSY if they can be determined from another model or analytic solution. [3] c. Motivations for COSY modifications An optical layout of the ARIEL HRS has been designed using COSY Infinity, including correction of nonlinear effects through 5th order [4]. This design utilized COSY’s existing modelling for electrostatic elements and fringe fields. The HRS layout includes a multipole electrostatic corrector has been modelled in OPERA. This design allows for correction of nonlinear effects through 5th order. The geometry of the corrector’s poletips, however, does not create “pure” multipoles that would match the internal models in COSY. Additionally, grounding shunts used to shorten the fringe field length are also inconsistent with COSY’s internal models. Using the OPERA model, a data file is generated with the values of the electrostatic fields and potentials in the midplane, including the fringe field regions. Additionally, physical measurements may be available at a later time from the actual corrector. By augmenting COSY’s beam physics package (COSY.fox), this data can be used to make a more accurate model of the element. These same modifications could also be utilized in simulating other beam lines that have electrostatic elements, such as the NIER spectrometer. As additional motivation, more accurate modelling of electrostatic elements has other applications. One is the modelling of a parallel plate deflector or other bending elements where the reference orbit does not maintain a constant radius of curvature. The increased accuracy of fringe field modelling for electrostatic elements could also be important in high precision EDM beam lines. 3. New Procedures ELFF and MELP a. Creating the model For both the ELFF and MELP procedures, detailed in section 3.c and 3.d, the electrostatic potential in the x-z midplane needs to be determined. For the CANREB multipole corrector, a design model from OPERA [5] was used and the potential is output into a text file for points on a grid encompassing the element and the fringe field region. It would also be possible to use measured data from an actual element. Once the potential data is determined, it needs to be represented in a format that is useful to COSY. In the case of the MELP procedure, the data points from the grid can be used as input for the COSY procedure. This process is described in more detail in Section 3.d The ELFF procedure takes a different approach. Using separation of variables, it represents the potential in the x-z midplane as the product of two functions with one independent variable for each. The grid of data points can be used to determine this function. The x, z, and potentials from the data grid from the OPERA model of the CANREB multipole corrector were imported into MATLAB [6] and plotted as a 3D contour. An example of this is shown in the figure below: Electrostatic Potential in x-z midplane for the full shunted HRS multipole corrector 6000 Potential (eV) 4000 2000 0 100 -2000 50 -4000 0 0 -100 -200 -50 -300 -400 -100 X position (cm) Z position (cm) element centered at z=0 Then a polynomial was used to fit the potential curve as a function of x in the center of the corrector (a location corresponding to z=0). An example of this is shown in the figure below: Best fit of Potential along x at z=0 in x-z midplane for full HRS multipole 6000 5000 4000 Potential in eV 3000 2000 1000 0 untitled fit 2 V0 vs. x0 Linear model Poly4: f(x) = p1*x 4 + p2*x 3 + p3*x 2 + p4*x + p5 Coefficients (with 95% confidence bounds): p1 = 1.27e-05 (1.045e-05, 1.495e-05) p2 = 0.00483 (0.004713, 0.004947) p3 = -0.02599 (-0.04794, -0.004043) p4 = -1.6 (-2.438, -0.7612) p5 = 21.23 (-16.74, 59.2) Goodness of fit: SSE: 3.033e+04 R-square: 0.9997 Adjusted R-square: 0.9996 RMSE: 43.54 -1000 -2000 -3000 -4000 -100 -80 -60 -40 -20 0 20 x position in cm at z=0 40 60 80 100 The 3D contour was fit using the product of the determined x-dependent polynomial and a z-dependent “top hat” function. This procedure maintains the greatest accuracy for the function in the middle of the element. The quality of the fit can be assessed by studying the R2 for the fit, where a value of 1 is a “perfect” fit to all points. In the example, an R2 value of 0.9981 was determined. V vs. x, z 6000 4000 V 2000 100 0 50 -2000 0 -4000 -50 0 -50 -100 -150 -200 -250 -300 -100 -350 -400 x z General model: f(x,y) = ((21.23) + ((-1.6)*x) + ((-.02599)*x*x) + ((.00483)*x*x*x) + ((.0000127) *x*x*x*x))*(1/(1 + exp(a1 - (a2*y)))) Coefficients (with 95% confidence bounds): a1 = -14.4 (-14.73, -14.06) a2 = 0.0914 (0.08925, 0.09354) Goodness of fit: SSE: 2.55e+06 R-square: 0.9981 Adjusted R-square: 0.9981 RMSE: 54.49 b. Using a 2 vs 6 parameter ENGE function Consideration was given in the modelling to using a full 6-parameter ENGE function, such as the one used internally by COSY.fox, or a 2-parameter “top hat” function. MATLABs curve fitting function allows for custom equations, but in many cases it had difficulty fitting the contour plot to a 6 parameter ENGE function for the z dependency. Studying the off-axis horizontal electric field (Ex) a comparison was made to the 2 vs 6 parameter fit. An example of the 6-parameter fits is shown below: 4 Ex along z in x-z midplane - offset 7 cm horizontally from optical axis x 10 untitled fit 3 Ex8 vs. z8 0 General model: f(x) = (-78746)/(1 + exp((a1) + (a2*x/220)+ (a3*x*x/220/220) + (a4*x*x*x/220/220/220) + (a5*x*x*x*x/220/220/220/220) + (a6*x*x*x*x*x/220/220/220/220/220))) Coefficients (with 95% confidence bounds): a1 = -7.571 (-15.48, 0.3338) a2 = 27.31 (-26.22, 80.83) a3 = 165.2 (21.33, 309) a4 = 280.5 (92.13, 468.8) a5 = 213.2 (95.38, 330.9) a6 = 56.6 (29.21, 83.99) -1 -2 Ex in V/m -3 -4 -5 Goodness of fit: SSE: 1.142e+06 R-square: 1 Adjusted R-square: 1 RMSE: 180.6 -6 -7 -8 -400 -350 -300 -250 -200 -150 z position in mm (z=0 is center of element) -100 -50 0 This was compared to a 2-parameter fit for the same data: 4 Ex along z in x-z midplane - offset 7 cm from optical axis x 10 untitled fit 3 Ex8 vs. z8 0 -1 -2 Ex in V/m -3 General model: f(x) = (-78746)/(1 + exp((a1) + (a2*x/220))) Coefficients (with 95% confidence bounds): a1 = -12.09 (-12.35, -11.83) a2 = -16.92 (-17.28, -16.55) -4 -5 Goodness of fit: SSE: 7.777e+06 R-square: 0.9999 Adjusted R-square: 0.9998 RMSE: 446.5 -6 -7 -8 -400 -350 -300 -250 -200 -150 z position in mm (z=0 is center of element) -100 -50 0 In both cases the fits were nearly perfect for the data points given. The value of R 2 for the 6-parameter fit was 1 compared to .9999 for the 2 parameter fit. The extra computation time and accuracy of using the 6-parameter function seems unnecessary, and the 2-parameter “top hat” function was chosen for the z-dependency. It would be a relatively straight forward modification, however, to add a full 6 parameter ENGE function to the ELFF procedure if it were needed. c. COSY Modifications To add functionality of these 2 new procedures, several modifications should be made to the COSY.fox beam physics package. These changes assume that the current version (COSY.fox Version 9.1 – updated January of 2013) is being used. The changes are listed in RED and comments to assist user in understanding the changes are listed I BLUE. Add the procedures in RED to the procedures for electrostatic elements in COSY.FOX (Version 9.1, Jan 2013). Make sure to recompile it before using it. Do not add the comments in BLUE. PROCEDURE ELFF B1 B2 B3 B4 B5 B6 B7 A1 A2 L S1 S2 D; {Non-bending Electrostatic element from potential function} {Specifies 1/2 of an electrostatic element of multipole order 2 and higher via a function that denotes the potential in the x-z midplane. Assumes non-bending reference orbit} {J. Maloney triumf.ca 05/03/2014} VARIABLE LLPI 1 ; PPOL(1):= B1; PPOL(2):= B2; PPOL(3):= B3; PPOL(4):= B4; PPOL(5):= B5; PPOL(6):= B6; PPOL(7):= B7; PPOL(8):= A1; PPOL(9):= A2; NSDP:=-15; LLPI:= LPI; LOFF:=2; CE:='ELFF'; IF S1<0; DL S1; LOCSET 0 S1 0 S1 0 0; SDELE S1 S2 D/100 D/20 D/10 D; ELSEIF S1=0; LOCSET 0 -L 0 -L 0 0; SDELE S1 S2 D/100 D/20 D/10 D; DL -(S2-L); ENDIF; LPI:=LLPI; UPDATE 0 1 1; ENDPROCEDURE; PPOL are global COSY variable used to pass parameters to other subroutines, particularly those used to integrate fields and potentials. NSDP is a variable used to flag the appropriate method to determine fields and potentials for elements. Negative values are used for sdependent elements based on information from the x-z midplane and they are call in procedure POTXZ LOFF is an internal flag set to 1 or 2. that is s dependent and/or bending 2 should be used for any element LOCSET sets a local coordinate system for COSY integration. It is parameterized in terms of X Z P S V T. When parameters are set to zero, the values are controlled by the global reference orbit. Setting a negative value for Z and S tells COSY that its integration begins at some different location than the start of the element. In the first IF, the values are negative due to the negative drift before the entrance to the element. In the second case, they are adjusted so that z=0 is defined as the exit to the element. LOCSET has been redefined to have fewer parameters in this version of COSY.fox than in prior versions SDELE is an S-dependent procedure to integrate the fields/potentials specified for the x-z midplane. The first and second parameters represent the initial and final points for integration along the reference orbit. The 3rd through 5th parameters specify the minimum, suggested, and maximum step size used in the variable step size integrator. The final terms is the off plane aperture that is used to set the integration boundaries. PROCEDURE MELP L A NX NZ DX DZ SIGMA D SX SZ SPHI; {ELEMENT DETERMINED BY MEASURED ELECTROSTATIC POTENTIAL DATA} {NEW PROCEDURE - J. Maloney triumf.ca 03/05/2014} VARIABLE DS1 1 ; VARIABLE IX 1 ; VARIABLE IZ 1 ; IF (SIGMA<0.5)+(SIGMA>5.0) ; WRITE 6 ' *** ERROR IN MELP, SIGMA < 0.5 OR SIGMA > 5.0' ; ENDIF ; IF (DX<0)+(DX=0)+(DZ<0)+(DZ=0) ; WRITE 6 ' *** ERROR IN MELP, DX =< 0 OR DZ =< 0' ; ENDIF ; MFP(1) := 0 ; LOOP IX 1 NX ; LOOP IZ 1 NZ ; MFD(IX,IZ) := A(IX,IZ) ; ENDLOOP ; ENDLOOP ; PPOL(1) := NX ; PPOL(2) := NZ ; PPOL(3) := DX ; PPOL(4) := DZ ; PPOL(5) := SIGMA ; NSDP := -16 ; LOFF := 2 ; DS1 := MIN(DX,DZ) ; LOCSET SX SZ -SPHI*DEGRAD 0 0 0 ; CE := 'MELP' ; SDELE 0 L DS1/100 SQRT(DS1*L/5) L/5 D ; IF MFP(1)>0 ; WRITE 6 (' --- WARNING IN MELP, OUT OF RANGE OF DATA AT '& SF(MFP(1),'(I8)')&' POINTS') ; ENDIF ; ENDPROCEDURE ; Add these lines (in RED) to the existing POTXZ procedure in COSY.fox before the “ELSEIF TRUE; …”. Line : {Code for new procedures - J. Maloney ELSEIF NSDP=-15; triumf.ca 30/50/2014} {Electrostatic Potential Function in Midplane} V:=PPOL(1); V:=V+PPOL(2)*x; V:=V+PPOL(3)*x*x; V:=V+PPOL(4)*x*x*x; V:=V+PPOL(5)*x*x*x*x; V:=V+PPOL(6)*x*x*x*x*x; V:=V+PPOL(7)*x*x*x*x*x*x; V:=V/(1+exp(PPOL(8)+(PPOL(9)*z))); ELSEIF NSDP=-16 ; {Measured Electrostatic Potential Data} V:= GAUSS(x,z,PPOL(1),PPOL(2),PPOL(3),PPOL(4),PPOL(5),MFD,J); {MFD(1):=MFD(1)+J;} write 26 cons(x) cons(z) cons(v); Care should be taken in specifying the ENGE coefficients since the function uses A2*z instead of the more traditional A2*(z/2D) where 2D is the full aperture (the full width). My testing had verified that the data array can be as large as 700x700 now without error. Not sure why this works for potentials and not for the magnetic field data. It may be that the variation between data points is an issue. In principle, this procedure could also be modified to allow input of Ex and Ez for the grid as well, but specifying as electrostatic potential is more direct and clean. The write command will generate a file (fort.26) with data for X, Z and V through the element. This can be compared to the imported data set. In the existing POTXZ procedure in COSY.fox, comment out the last line of the ELSEIF NSDP=-5 subroutine. This will look like this: {MFD(1) := MFD(1)+J ;} **** This line produces and error when not commented out saying that J is not specified as an array and is being added to the global array MFD. This line was not included in prior versions of COSY.fox and I believe it may be intended to hold a derivative or error parameter. In the existing code, J is defined as a scalar and set to zero and then used to hold the error flag (J=1 is the error flag) in the function GAUSS. I have put in a similar line of code and commented it out in my field data element. **** d. Instructions for using ELFF and MELP PROCEDURE ELFF B1 B2 B3 B4 B5 B6 B7 A1 A2 L S1 S2 D allows you to specify an electrostatic element by expressing the potential (in kV) in the xz midplane as a function of the form: ππ¦=0 (π₯, π§) = (π΅1 + π΅2 ∗ π₯ + π΅3 ∗ π₯ 2 + π΅4 ∗ π₯ 3 + π΅5 ∗ π₯ 4 + π΅6 ∗ π₯ 5 + π΅7 ∗ π₯ 6 ) ∗ (1⁄ ) (1 + ππ₯π(π΄1 + π΄2 ∗ π§)) where B1 through B7 are the polynomial coefficients for the “x” dependency and A1 and A2 are parameters for a 2-parameter “top hat” function for the “z” dependency. L represents the effective length of the element itself in meters. S1 and S2 are the beginning and final points along the reference orbit for integration of the fields/potential. D represents the aperture (from the reference orbit to the poletip) in meters. This element assumes a non-bending reference trajectory in the x-z midplane. Since it is generally difficult to specify an element with both entrance and exit fringe fields in a single function of this type, an element can be split into 2 parts. The first part will include the entrance fringe field. This can be done by specifying a value for S1 that is negative distance in meters from the physical entrance to the element. S2 will represent the distance in meters from the entrance to the element. L will represent the actual length from the entrance to S2. For the exit fringe field, S1 should be set to 0. L will be the distance to the exit of the element and S2 will represent the total length for integration of the reference orbit. As a comparison, keep in mind that COSY.fox internally integrates for a minimum distance of 5*D for the fringe fields outside the element and 3*D for the fringe fields inside the element. This element could be used without fringe fields by setting S1=A1=A2=0 and L=S2. Then the values of polynomial coefficients will also need to be multiplied by 2. This, however, wold merely remove the z dependency and make the potential function identical to those already included in COSY.fox for electrostatic multipoles This “hard edge” case is uninteresting except as a benchmark of the new procedure in comparison to other elements already existing in COSY.fox. For entrance and exit fringe fields, the sign of A2 will also need to be changed. Generally the value of A2 should be negative for entrance fringe fields and positive for exit fringe fields. PROCEDURE MELP L A NX NZ DX DZ SIGMA D SX SZ SPHI allows you to specify an entire electrostatic element, including any bends or fringe fields, by inputting data for the electrostatic potential at points in a rectangular grid in the x-z midplane. This procedure mirrors the input methods COSY uses for the MF procedure to specify an element by the magnetic field in the midplane. COSY uses its Gaussian wavelet function to interpolate the potential between the specified points as COSY integrates along the reference orbit itself. L represents that actual path length for the reference particle trajectory as it travels through the element. A is an array that specifies the electrostatic potential in the rectangular grid. NX and NZ represent the number of grid points along X and Z, respectively. DX and DZ are the spacing, in meters, between each point. The first entry (1,1) is the value at the lower left-hand point on the grid. X represents the horizontal offset from the reference orbit and z represents the Cartesian coordinate in the general direction of the beam propagation. The actual point that the reference particle orbit enters the element is specified with the parameters SX and SZ and should correspond to offset in meters within the grid. SPHI represents the angle of the particles trajectory (in radians) at this point from the z direction. SIGMA is a parameter used by the Gaussian interpolator. It should have a value generally between 1.2 and 1.8. Smaller values of this parameter represent a coarser grid of data point. D represents the aperture in meters from the reference orbit. One helpful diagnostic from this procedure is the output generated by COSY.fox to a file named fort.26. This file will contain the calculated values of the local horizontal offset (x), local Cartesian z, and electrostatic potential at points along and near the reference trajectory. Since these are calculated using the Gaussian interpolator from the data grid provided they provide a possible diagnostic tool. Also, MELP will return error messages similar to those used in the MF procedure if the grid spacing creates potential jumps that are too drastic, the choice of SIGMA is too large or small, or if the spacing between points is entered as a negative or zero value. e. Benchmarking The initial testing of the ELFF procedure was with the trivial case of an electrostatic quadrupole without fringe fields. A short drift was placed before and after the element. This was compared to the internal procedure EQ in COSY.fox. The resulting transfer maps were identical. A more elaborate test was done by adding basics fringe fields to the EQ model using the FR 1 model in COSY. The ELFF model used only a 2-parameter “top hat” function, but the results were still very closely matched: --- BEGINNING COMPILATION --- BIN FILE READ: C:\Program Files (x86)\COSY 9.1\cosy --- BEGINNING EXECUTION Map using EQ and FR=1 -1.131068 -0.8786041 0.0000000E+00 0.0000000E+00 0.0000000E+00 100000 -0.3177786 -1.130968 0.0000000E+00 0.0000000E+00 0.0000000E+00 010000 0.0000000E+00 0.0000000E+00 5.957681 2.774008 0.0000000E+00 001000 0.0000000E+00 0.0000000E+00 12.43414 5.957422 0.0000000E+00 000100 0.0000000E+00 0.0000000E+00 0.0000000E+00 0.0000000E+00 1.000000 000010 0.0000000E+00 0.0000000E+00 0.0000000E+00 0.0000000E+00 0.9999997 000001 -----------------------------------------------------------------------------Map using ELFF and 2 parameter ENGE function -1.130922 -0.8785777 0.0000000E+00 0.0000000E+00 0.0000000E+00 100000 -0.3175417 -1.130922 0.0000000E+00 0.0000000E+00 0.0000000E+00 010000 0.0000000E+00 0.0000000E+00 5.957490 2.773727 0.0000000E+00 001000 0.0000000E+00 0.0000000E+00 12.43514 5.957490 0.0000000E+00 000100 0.0000000E+00 0.0000000E+00 0.0000000E+00 0.0000000E+00 1.000000 000010 0.0000000E+00 0.0000000E+00 0.0000000E+00 0.0000000E+00 0.9999997 000001 -----------------------------------------------------------------------------=== COSY RUN FINISHED === To test MELP, an array of data points was analytically generated to model the electrostatic quadrupole and COSY’s internal fringe field. Then the results were compared to the basic simulation using EQ, FR 1 and drifts. Testing was done for grids of different mesh densities and also with variations in the SIGMA fit parameter. For example, here is a comparison using SIGMA of 1.8, horizontal spacing of .25 cm and longitudinal spacing of 1.25 cm between data points; --- BEGINNING COMPILATION --- BIN FILE READ: C:\Program Files (x86)\COSY 9.1\cosy --- BEGINNING EXECUTION Map using EQ and FR=1 -1.131068 -0.8786041 0.0000000E+00 0.0000000E+00 0.0000000E+00 100000 -0.3177786 -1.130968 0.0000000E+00 0.0000000E+00 0.0000000E+00 010000 0.0000000E+00 0.0000000E+00 5.957681 2.774008 0.0000000E+00 001000 0.0000000E+00 0.0000000E+00 12.43414 5.957422 0.0000000E+00 000100 0.0000000E+00 0.0000000E+00 0.0000000E+00 0.0000000E+00 1.000000 000010 0.0000000E+00 0.0000000E+00 0.0000000E+00 0.0000000E+00 0.9999997 000001 -----------------------------------------------------------------------------Map using measured potentials -1.167639 -0.8961179 0.0000000E+00 0.0000000E+00-0.5391790E-01 100000 -0.2909835 -1.079748 0.0000000E+00 0.0000000E+00-0.8809345E-01 010000 0.0000000E+00 0.0000000E+00 5.837715 2.596748 0.0000000E+00 001000 0.0000000E+00 0.0000000E+00 12.09258 5.550351 0.0000000E+00 000100 0.0000000E+00 0.0000000E+00 0.0000000E+00 0.0000000E+00 1.000000 000010 0.8717215E-01 0.2072441E-01 0.0000000E+00 0.0000000E+00 1.000657 000001 -----------------------------------------------------------------------------=== COSY RUN FINISHED === Adjusting the grid size means varying degrees of interpolation by COSY as it integrates along the reference path. Like the MF procedure for magnetic field data, the computation time involved in the MELP procedure is much greater than the function based procedure or COSY’s own internal modeling. For example, this previously mention model, with an 82 x 320 grid took approximately 12 seconds to compile as compared to the near instantaneous run of the internal procedures. Additional comparisons are being made with more complicated models, including electrostatic deflectors. f. Conclusions Some preliminary conclusions can be drawn from the initial testing of these new elements. The current procedures in COSY allow only basic modelling of electrostatic elements consistent with very general analytic functions. Additionally, although COSY does have fringe field modelling, the default model is not accurate for electrostatic elements. Lastly, the adjustment made by COSY to account for longitudinal fields in electrostatic elements is a potential source of error. Using a function to model elements, including fringe fields offers a quick and more consistent method of modelling these elements. This works similar to the internal procedure for general optical elements in COSY.fox, GE, but is based on a fit to data in the whole midplane rather than just along the reference orbit. This is important for many non-bending electrostatic elements where the potential along the optical axis is very close to zero. For more accurate modelling, particularly for bending elements, the data grid based MELP procedure allows for modelling complex and even non-symmetric electrostatic elements. COSY assumes that the reference particle travels at a constant radius of curvature through these deflecting elements, but MELP allows modelling of elements where the reference particle follows a parabolic orbit instead. It also allows modeling of beam elements where the potential cannot be accurately expressed as a simple analytic function. One drawback to the MELP procedure is the greater amount of computation time involved due to the extra interpolation that COSY must perform. Also, this procedure will be sensitive to error if the spacing on the data grid is too large. These issues, however, are not unique and already exist with using the current MF procedure to model magnetic elements form measured magnetic field data. 4. References [1] K. Makino, M. Berz, COSY Infinity Version 9, Nuclear Instruments and Methods A558 (2005) 346-350. [2] M. Berz, Advances in Imaging and Electron Physics, Vol. 108, (1999) pp. 125- 126. [3] R. Baartman, End Effects of Beam Transport Elements, July 2001. [4] CANREB HRS, TRI-DN[5] OPERA - Software for electromagnetic design, Cobham, plc., http://magnet-designsoftware.com/product/ [6] MATLAB, The Mathwork, Inc., http://www.mathworks.com/products/matlab/