Test2d29.dat, 29th 'test’ for CPO2D

Magnetic Glaser lens


The magnetic field option for CPO2D was added in Dec 2012. This test file simulates the Glaser lens.


The axial magnetic field is bell-shaped,

b(z) = B0/(1 + (z/a)**2),

to give a Glaser lens. According to P. Grivet, Electron optics, Pergamon Press, 1965, if the object and image are in field-free spaces then the image focal length is given by (exactly)

f = a*p/sin(p*pi),


p = sqrt(1 + (a*e*B0/(2*m*v))**2).

In the present example we have chosen B0 = 0.01 T, a = 1 mm, and the electron energy E = 0.73284 eV, to give p = 2, and hence f = infinity.

It can be seen that in image space the rays are indeed approximately parallel to the axis.

Some of the lack of exact parallelism will be due to the fact that fields at the object and image points are in fact not zero but are 0.5% of the central field strength. Also, aberrations will affect the present results.

Some less important points:

(1) During ray tracing the plot shown on the screen is r*cos(phi) versus z, but this is changed to r versus z after clicking on OK, and can be changed back again using the view drop-down menu. From the plot of r versus z it can be seen that the rays approach very closely to the axis at z = 0 (presumably they would cross the axis in an exact calculation).

(2) Contour plots of the magnetic field show a zero field for r > 0.4, because the field is not defined in these regions. Note that the 'ignore missing points' option has been used to prevent crashes.

(3) The 2D grid of magnetic field values is in the file test29.dat, called by the above data file. This grid has been generate by a 2-step process. Firstly the user generates axial values, using some program, and puts them into a file named tempin.dat. For example there could be 350 values from z = -16 in steps of dz = 0.1. The following lines would then be added to the beginning of tempin.dat (the comments are not read by prog04):

2D symmetry

complete complete set

5 350 5 radial points, 350 axial points

-17. 0.05 0.1 initial z, step sizes in r and z directions

0 no redundant numbers on the following lines

See the notes in prog04.f90 for more detailed information.

If only one step size is entered then it is used for r and z.

In the second stage the user calls prog04.exe (supplied with the CPO package), which reads from tempin.dat and puts the axial and radial components of B into the file tempout.dat, in a form suitable to be read from test2d29, after being renamed test29.dat.

Prog04 calculates the radial components by using the first and higher differentials of the axial field. (In this process some of the end values of the axial field are lost, which is why the initial value -17 of z used above is lower that the initial z of the rays.)