Test2d02, 2nd 'benchmark test' data file for CPO2D

Idealised cylindrical deflection analyzer


This deals with the 'perfect' cylindrical deflection analyzer, and is the analogue of test2d01.dat.


Detailed description:

The number of segments used in the present example is small enough for the example to be run with the ‘demo’ version of CPO2D. Higher accuracy could of course be obtained with more segments, using the standard or full versions of CPO2D.


The following data were obtained when the memory and speed of PC's was much more limited than at present, so the available number of segments was small and the requested inaccuracies were fairly high to give a quick demonstration.


Here 'planar' symmetry is used, so that the system extends an infinite distance in the +/- y directions. The electrodes are specified as arcs of circles that subtend 90 degrees. After reflection in the x=0 and z=0 planes these become full circles. With the planar symmetry they becomes cylinders of infinite length.


The radii of the cylinders are 0.75 and 1.25, and the numbers of subdivisions for the 2 cylinders (15 and 25) have been chosen to be approximately proportional to their radii, as recommended.

The requested inaccuracy for the potentials and fields is 0.001.

The potentials of the hemispheres are such that the potential at the mid-radius (r = 1) should be 1 and the field should be 2. More generally, the potential is 1-2*ln(r) and the field is 2/r (see detailed equations on CDA). The calculated values at various points between the spheres cylinders on the screen and in the ray output file (tmp2a.dat), and are consistent with the requested inaccuracy, to within a factor of about 2.

The following table gives a small sample of results, to illustrate how the inaccuracy (err) in the potential depends on (1) the total number (N) of segments, and (2) the requested inaccuracy (acc_pot) for the evaluation of the potentials and fields:


N        acc_pot        err                err*N^2

24        0.0001                0.0014                0.81

40        0.0001                0.00065        1.04

64        0.0001                0.00020        0.82

80        0.0001                0.00013        0.83

160        0.0001                0.00003        0.77

160        0.00001        0.000034        0.87


It can be seen that the errors do not seem to depend on acc_pot in this example (which is unusual), but that they are approximately proportional to 1/N^2. The errors in the fields have the same dependence and approximately the same magnitude. The dependence on N allows the results to be extrapolated to N = infinity, as described in Chapter 3 of the User's Guide.


The ray starts at x = 0, z = -1. The requested inaccuracy for the ray tracing (acc_traj, say) has been set at .001, and the maximum step length (step_max, say) has been set at 0.6 (see below).

The value of z after a rotation of 180 degrees around the y axis (that is, at the plane x = 0, which has been specified as the second 'test plane') should be +1.0, and in this example is 1.0009 (see the output data file 'tmp1a.dat'). The first 'test plane' has been put at a rotation angle of 127.3 degrees, to correspond to the exit plane of the ideal cylindrical deflection analyzer, and here the median ray crosses at a distance of 0.9991 from the centre, as can be seen from the output data file. It can also be seen on the screen that the 2nd and 3rd rays, which start at angles of +/- 0.1 radians to the dispersion plane, cross very near to this plane, as expected.

This ray error depends on the values of acc_traj and step_max.

The value of acc_traj obviously represents the minimum error, but the actual error might be larger if step_max is not well chosen.

If step_max is too large the interpolation to find the values of the coordinates and velocities at the exit plane will be inaccurate (unless by chance the end point of a ray step happens to be near the exit plane).

In the present example (for which the scale length is 1) it is found empirically that the 'exit plane interpolation error' for z can be as high as of the order of 0.03*step_max**7 (that is, it is of the order of 0.0008 for a step length of 0.6). For other simulations the dependence on the step length might be quite different, eg this type of interpolation error might be negligible for a simulation in which the rays are nearly straight at the exit.

Using the 'mesh' method of ray tracing, with a mesh spacing of 0.1 (and the other parameters as in the middle line of the above table), gives essentially the same error but takes about 3 times longer. However, further rays that are close to this first one are much quicker. The mesh method is therefore the more efficient, in this example, if 4 or more closely spaced rays are required.

To obtain 100 full rotations of the electron, take the following steps:

(1) Use the mesh method, with mesh spacing 0.03 (note 18)

(2) Change the minimum r of the ray to -1.5 (note 21)

(3) Set the maximum time to 1.1E-3 (note 23), to stop the ray tracing

(4) Put the letter 'm' in the 6th space in the line that gives the number of test planes, to signify that multiple crossings are required

(5) Add 200 in the next 2 lines (after the values of a, b and d), to give the number of crossings of each plane before the crossing information is retained (and note that each plane is crossed twice in each full rotation)

(6) Use a single ray, the median ray

You will then see in the output file (tmp1a.dat) that after 100 full rotations the final value of z at r = 0 is 0.9975, a result so good (as in the first benchmark test) that it surprises even the author of this program!