xmpl2d07, 7th 'example' data file for CPO2D

Automatic iteration to focus a beam by 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 is the 2D version of xmpl3d06.

See also the introdution to automatic focusing and the detailes notes


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.

The source is at z = -4 and the 'beam of rays' option is used to specify 12 rays and to select 'completely random disc and pupil' to give a point source with rays radiating uniformly.  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 25.

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

 from that obtained with xmpl3d06.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.