xmpl3d06, 6th 'example' data file for CPO3D

Automatic iteration to optimise the focus of an einzel lens.


A simple 3-cylinder lens is used in this example. The potential of the middle cylinder is varied to minimise the size of the disc of least confusion.


This simulation has axial symmetry and so a faster solution can of course be obtained using CPO2D -see xmpl2d07.

See also the introdution to automatic focusing and the detailes notes

The lens is a 3-tube einzel lens.  

The initial number of segments is small but the 'adaptive segmentation' option is used to increase this to 500, giving a high density of segments near the gaps between the electrodes.

All the available symmetry planes are used, which effectively increase the number of segments by a factor of 16.

The choice of the type of beam is important because most choices result in the rays being distributed as a set of rings.  So the source here is at z = -4 and the 'cylidrical beam' option is used to specify 12 rays, and 'completely  random  disc and pupil' is selected to give a point source with rays  radiating in random directions.  In the 'randomization parameters' box the 'same' option is selected  to give the same set of rays for each focus iteration -this  is important for  the correct operation of the minimization operation.

The following parameters are specified for 'automatic focussing':

(1) The voltage to be varied is that of the midddle electrode, voltage number 2.  It starts at 4.2 and the initial excursion is 0.2,

(2) The required focus is set at z = 4, where there is a test plane.

(3) The number of rays to be included in the minimization is 12, which is the total number of rays -if it were less then some of the rays furthest from the focus would be excluded from the minimization. 

(4) The quanity to be minmized is chosen to be the distance from the axis, to obtain the disc of least confusion.

(5) a 'penalty' is introduced if the distance of a ray from the axis at the focal plane is greater than 0.1,

(6) The number of iterations is set at 15.

It can be seen that the final value of v2 is 4.097, and that the 'disc of  least confusion' is correctly at z=4.  The value of v2 is only slightly different 

 from that obtained with xmpl2d07.dat, but these example files use small numbers of segments and rays. 

The printing level is set at 'z', for 'zero', so that only the adjustable voltages and the focal size are shown (and remember that the focal size 

 includes a 'penalty' component when the constraints are activated).

In a more serious study of this lens the cylinders would obviously be given more subdivisions, there would be a larger number of rays and

more iterations of the voltages would be used.