Section 2.9 of the User's Guide for CPO2D and CPO3D

(or proceed to section 2.10)


Ray tracing (that is, trajectory integration).


Rays can be traced for particles of any mass and charge, and for beams of mixed mass and charge.


Relativistic equations of motion are automatically used, when appropriate for the inaccuracy level that is being used.

Rays can be traced forwards or backwards in time (the latter option being useful when the user needs to know where rays should start from to reach a given final point).


Two methods of ray tracing are available, the 'direct method' and the 'mesh method'.


The direct method

This uses the fields calculated directly from the known charges on the electrodes. It tends to be the more accurate (for a given tracing time) when the number of rays is not large. It also tends to be the more accurate when there is a large field variation along the path of the ray, as when a ray passes near to the edge of an electrode. In general it is the safer technique.


The mesh method

The potentials and field components are calculated and stored at mesh points in the vicinity of the ray. This is done during the evolution of the ray. When the program needs a potential or field at a point on the ray it looks for the values at nearby mesh points and interpolates between them. If a mesh point does not yet exist and the program cannot find the required value then the program creates the mesh point, calculates the potential or field components and stores the information. The mesh points that are created in this way form an incomplete array (which is usually a square array in CPO2D and a cubic array in CPO3D, but can be otherwise).


The potentials are stored in one array of mesh points, and the field components in a separate array. Both arrays have the same spacing and origin. The potentials and/or fields at the mesh points are used at the time of creation of the points (and again later if there are further rays passing through the same region) to calculate the fields needed for tracing the ray. The mesh technique is therefore particularly useful when a large number of neighbouring rays is required.


The spacing of the mesh points is specified by the user. A small mesh spacing will improve the accuracy but will also increase the tracing time.


Test planes

Up to 25 test planes can be specified. One of these planes might be the expected focal plane of a system while others might be planes at which the user wants to inspect the parameters of the rays. The user defines the planes by giving the values of a, b, c and d in the condition:


CPO2D, axial symmetry: a* + b*z = c,

CPO2D, planar symmetry: a*x + b*z = c,

CPO3D, any symmetry: a*x + b*y + c*z = d.


For example, if b and c are zero in CPO3D the plane defined in this way is x = d/a. As another example, if a = 1, b = -1, c = 0, d = 0, then the equation becomes x = y, which specifies a plane that passes through the z axis and bisects the angle between the positive x and y axes.


If a ray crosses a test plane all the ray information at the crossing point will appear in the 'information' box on the screen and will be put into the output data file (unless the printing level has been set low). For simulations in which a plane is crossed more than once, the user can specify the number of crossings to be ignored before the ray information is retained.


The option also exists to stop rays when they hit an electrode. The final ray parameters that are put into the output file are then those at the hitting point.


(proceed to next section)