Two methods of ray tracing.


This note concerns the two methods for tracing the rays, the 'direct' method and the 'mesh' method.


In both the direct and mesh methods the rays are traced by the well-known Bulirsch-Stoer technique (a 4th order technique, using rational fraction interpolation). The length of a given step is subdivided as many times as is necessary (typically 16) to achieve the requested inaccuracy, but information about the intermediate points is not retained.


The direct method uses the potentials and fields calculated directly from the known charges on the electrodes. This method tends to be the more accurate for a single ray and for a given tracing time. It also tends to be the more accurate when the fields vary quickly with distance, as for example when a ray passes through a strong field near the edge of an electrode. It can however lead to a slowing down of the ray tracing when a ray passes through an electrode (because then time-consuming exact calculations of the potentials of the nearby segments have to be used).


In the mesh method the potentials are calculated and stored at mesh points in the vicinity of the rays. So the mesh method creates a 'grid' or array of points in the volume occupied by the rays (including a short transverse extension). These mesh points are created only as needed, in the region occupied by the beam. At each ray step the program looks for the fields (and sometimes also the potentials) at nearby mesh points and if it does not find these fields it calculates them and stores them. These fields are used at that time (and again later if there are further rays passing through the same region) to calculate the local field needed for tracing the ray. The field at an arbitrary point is obtained by bilinear interpolation using the fields at the corners.


The arrays of mesh points do not have to be square or cubic -see the relevant note.


The mesh technique is most useful when a large number of neighbouring rays are required. You will notice that rays are traced quickly when they go through regions where the mesh points have already been set up.


In general the direct method is the safer of the two methods, although it can be the slower when the number of rays is large.


For more detailed information see:


Starting ray tracing

The 'direct' method

The 'mesh' method

Choosing the mesh spacings

Extra accuracy for near_axis rays (in CPO2D only).

Specifying the initial ray conditions

Beam section (limiting number of points