The 'mesh' method of ray tracing.

Two methods that can be used to trace the rays through the system (that is, to integrate the trajectories) the 'direct' method and the 'mesh' method.

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 incomplete array, of points in the volume occupied by the rays (including a short transverse extension). In CPO2D there is usually a square array, in CPO3D a cubic array, but the dimensions in different directions can be different.

The mesh points are created only as needed. At each ray step the program looks for the potentials at nearby mesh points and if it does not find these potentials it calculates them and stores them. These potentials are used at that time (and again later if there are further rays passing through the same region) to calculate the potentials needed for tracing the ray.

The potential at an arbitrary point inside a set of mesh points is obtained by bilinear interpolation using the potentials at the 4 corners of the 2Dset or the 8 corners of the 3D set.

An analogous but separate mesh of points is also created by the program, again only as needed, to hold the values of the field components. Both sets of meshes have the same mesh spacing and the same origin.

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.

The mesh method can lead to inaccuracies when a ray passes close to a sharp edge of an electrode, because the field is then strongly non-uniform and so interpolation between the grid points becomes inaccurate (which is also the reason that the Finite Difference and Finite Element methods are usually inaccurate under these conditions).

The maximum number of mesh points is 'maxmesh'.

The mesh method can be used with the option for sinusoidal voltages -the program then stores the potential and fields data for the minimum and maximum of the sine wave (so the number of mesh points is therefore effectively doubled). But the mesh method cannot be used with other types of time-dependent voltages.

A small mesh spacing will improve the accuracy but will also increase the tracing time.

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.