Optimising the accuracy

In principle you should already have looked at chapter 3 of the users guide, and section 2 in particular.  There is some overlap with the material here.

The CPO programs are extremely accurate and fast.

For a recent description see the paper: Achieving the highest accuracy with the BEM, by F H Read, Microscopy and Microanalysis 21 Suppl S4, 182-187 (2015).

The method of calculation used in the CPO programs (the Boundary Element Method) is almost always much faster and more accurate than the traditional methods used in most other programs. The only published comparisons that are known to us are two papers that show that the CPO programs are typically two orders of magnitude more accurate than those using the traditional methods.

The user has an exceptionally wide degree of control over the programs, but at the beginning of a study WE STRONGLY ADVISE THE NEW USER NOT TO SELECT:

a large number of segments, or

very low inaccuracy levels, or

short step lengths or times for the ray tracing.

Instead when you first start to set up a new simulation choose the numbers of segments and rays, the inaccuracies and the step lengths or times SO THAT THE RUNNING TIME IS LESS THAN A FEW MINUTES. Then, after you have optimised the parameters and have understood how your system behaves -AND NOT BEFORE- increase the numbers of segments and rays, decrease the requested inaccuracies and use shorter step lengths or times (but not too short) to obtain the final answers.

Better still, follow the strategy described below (and in more detail in Chapter 3) to minimise the errors and the computing time and, as a bonus, to obtain estimates of the errors.

AND NOTE WELL that very few other programs disclose the magnitude of the errors of the calculated fields. Instead they mention a trivial inaccuracy -the precision for solving the main matrix equation (which is of the order of 10 to the minus 13 in the present programs) -but this is many orders of magnitude smaller than the main sources of error.

The user chooses the inaccuracy level for ray tracing (that is, trajectory integrations), and also chooses the total number of segments. and the step lengths or times for ray tracing.

The inaccuracy levels are approximate fractional inaccuracies, and the program usually allows them to be as low as 0.0000001 for CPO2D and 0.000001 for CPO3D.

The maximum number of segments depends on the memory space available to the user, and is typically 2000 (but versions for 4000 and 6000 segments also are included with the package).

Those users who want the best accuracy and who are new to the CPO programs -particularly those who have been using FEM or FDM programs (that is, programs that are based on a 'grid' of points, such as SIMION)- will be tempted to start by using the smallest inaccuracy levels and the maximum number of segments, but this is usually not the best strategy.

In principle you should read chapter 3 of the User`s Guide, but in practice you might have already started and might already be using small inaccuracy levels and a large number of segments, in which case the following strategy will help you (and this strategy is also described under HELP!!).

(1) Identify some critical final parameter, such as the potential at some point or an end coordinate of a ray.

(2) Make a note of the present value of this final parameter.

(3) Choose an initial input parameter that probably has a relatively small effect on the final result and that can be changed to REDUCE THE ACCURACY. Examples of input parameters that are often suitable are

(a) the number of subdivisions of a non-critical electrode,

(b) the number of subdivisions in the direction around the axis for a set of cylinders in a 3-dimensional system,

(c) the ray inaccuracy,

(d) the maximum step length or time, or

(e) the number of rays

(4) Run the program again for 2 or 3 values of this initial parameter, changing it in large steps while keeping all the other input parameters unchanged, and plot a graph of the final parameter versus the initial parameter. One point on this graph is of course the result that you started with. If the initial parameter is an integer N then it is usually best to plot against 1/N or (1/N) squared. If the initial parameter is the number of segments then try to change it by factors of 4, or if that is not possible, factors of 2. Extrapolate, if possible, to a perfect accuracy for this input parameter, for example to 1/N = 0. Make a note of the difference between the extrapolated value of the final parameter and the value that you started with. You might feel at this stage that the input parameter can be permanently changed to give a faster running time, without affecting the final accuracy.

(5) Repeat this procedure for other initial input parameters, including those that you think will have a relatively large effect.

Now you should be able to make a quantitative judgement of the choice of initial parameters. You might find for example that you need more segments in some critical region, and that to compensate you can reduce the number of segments elsewhere (and if you have usually used FDM or FEM programs in the past -that is, programs that are based on a 'grid' of points, such as SIMION- and if you have followed the present advice, you will almost certainly be very surprised at how few segments you need to obtain high accuracy). In the case of rays you will probably also find that the ray inaccuracy need not be so small and that the ray step lengths or times need not be so short.

Equally importantly you will probably also have

(a) an estimate of the result extrapolated to a perfect accuracy, and

(b) an estimate of the error in the extrapolated result.

WHAT MORE COULD YOU WANT!

But perhaps the problem is of a different nature, for example involving space-charge or cathodes. Again the relevant test and example files give reassurance that difficult problems can be solved with good accuracy, so in this case look carefully at the footnotes of those files.

Also remember that an easy way to reduce the computing time (usually by more than a factor of 2) is to minimise the graphics box on the screen during the time of tracing, or to hide it with the edit or information boxes.

It was noticed in 2013 that the first run of a data file is faster than repeat runs (when not running in batch mode). This seems to be associated with an occasional extra time taken to print to the output files, but we do not understand this and have no control over it.