Choosing the accuracy levels


To optimise the speed of the program the user chooses the required accuracy, and then the program selects the appropriate approximations at each stage to try to achieve this accuracy. A high accuracy will of course require a longer computing time.  See separate note for the technical details.


See also the earlier description in the users guide, chapter 2, section 6.


The two main accuracies chosen by the user are

(1) the accuracy of the surface charges (that is, boundary charges), and

(2) the accuracy of the ray tracing (that is, trajectory integration).

These are treated separately by the program.


The accuracy of the surface charges is determined partly by the chosen accuracy of calculating potentials, let us call it accpot, and partly by the total number of segments, which we call N, into which the electrodes are subdivided.


The accuracy of the ray tracing is determined mainly by a further two choices that the user makes, namely:

(a) the approximate fractional inaccuracy for the tracing of a single ray step, let us call it acctraj, and

(b) the lengths of the steps, and let us call that dl.


The values of accpot and acctraj need not be the same (in fact accpot for the surface charges is usually smaller than acctraj). At the ray tracing stage the program uses the surface charges calculated with the original value of accpot, but new fields and potentials are evaluated using a value of accpot that is equal to acctraj.


For detailed information on the effects of accpot and N, see note on charge accuracy. For detailed information of the effects of acctraj, and dl see note on ray accuracy.


Most importantly, if you are in a hurry and you have already started see the advice in HELP!!, otherwise see Chapter 3 of the User`s Guide.


The allowed range of values of accpot is 0.000001 to 1. A suitable value is usually 0.1 for quick exploratory tests (see Chapter 3 of the User`s Guide), and 0.001 for the final answers. The actual inaccuracy will depend on the geometry, the choice of subdivisions for the electrodes, the total number N of segments, and other factors. It is particularly important to have a high density of subdivisions in critical regions. The inaccuracy that the user specifies is only a guide, and in any case the inaccuracy cannot be clearly defined in general.


To find what a result would be for an infinite value of N, vary N and plot the result against 1/N or (1/N) squared, and then extrapolate to 1/N = 0 (see section 3.3 of chapter 3). Try to change N by factors of 4, or if that is not possible, factors of 2. An example given in Chapter 3 concerns the parameters of the two cylinder lens described in the example file xmpl2d01.dat. The error in the object focal length f1 of the lens depends essentially only on accpot and N. The table shows the values obtained for a small value of accpot and for a range of values of N:

 N                112                128                160                240

 f1                0.79984        0.79979        0.79974        0.79968

 (1000/N)2        79.72                61.04                39.06                17.36

A graph of f1 versus 1/N2 is straight, giving an intercept at f1 =0.79964. For finite values of N the fractional error in f1 in this example is 2.5/N2.


The value of accpot can also often be extrapolated, to zero.


The allowed range of values of acctraj is also 0.000001 to 1. This inaccuracy parameter will be used by the program to define the inaccuracy with which the fields are evaluated and also to help to decide on the number of interpolation points created inside the step in the ray tracing routine (in which the Bulisch-Stoer method is used). The usual value is 0.1 for quick exploratory tests (see Chapter 3 of the User`s Guide), and 0.01 to 0.001 for the final answers (which often have an inaccuracy significantly smaller than that requested).


In the way that the program uses the Bulisch-Stoer method the inaccuracy is somewhere between a single step inaccuracy and a global inaccuracy, and is only an approximate indication of the actual inaccuracy that will be achieved with a particular simulation. In any case the inaccuracy of a ray tracing cannot be clearly defined in general.


The inaccuracy of the rays also depends on the step length dl or the step time dt, or more correctly the maximum step length or time that the user has specified. The inaccuracy can be decreased by using a small maximum step length or time, but can also be increased, above the value that has been requested, if an inappropriately large value of the maximum step length or time is chosen. So the user should carefully different combinations of acctraj and dl.


But do not make the maximum step length or time too small -this would increase the computing time very much without improving the accuracy. The program creates a number of interpolation points (usually a large number) inside each step.


The final overall inaccuracy is of course also influenced by the values of accpot and N and the choice of segments.


When the motion is relativistic the equations of motion are solved to an inaccuracy slightly better than that corresponding to acctraj. For example, corrections for the rate of change of mass with time are automatically used by the program when the energy is above the following thresholds for electrons:

 acctraj         threshold energy

 0.0001         25.6 eV

 0.001                 256 eV

 0.01                 2.57 keV

 0.1                 27.6 keV

The relativistic correction to the mass is used at all energies.  For more details see the note on integrating relativistic equations of motion.


As with the evaluation of the surface charges, the end point or other suitable measure of a ray can usually be improved by extrapolating the value of N to infinity, and it is also often possible to extrapolate acctraj and dl to zero (see Chapter 3 of the User`s Guide).