Contour details


General information on the Contour menu item is given in section 3 of chapter 5 and is repeated at the end of the present note. Here we give some detailed information.


The headings below are:

Potential contours:

Field contours:

Space-charge density contours:

Current density contours:

Potentials and fields in external regions:


For all contours: When the space-charge option is used for rays, the space-charges are set at the end of a run, before the start of the next iteration, so if the run is aborted before the end of a run the space-charges used for contours will be those of the previous run.



Potential contours:


The user specifies the number of grid points into which the horizontal and vertical axes will be subdivided, and also the accuracy to be used for calculating the potentials at the grid points. The program sets up the grid points and calculates the potential at each one. The 'direct' method is used for these calculations (see footnote 1). The contours are then drawn by interpolating between the values at the grid points.


Note that the grid points might not lie on the surfaces of the electrodes. The electrodes might not then appear as exact equipotential surfaces in the contour plots -see the note on potentials, fields and contours near to boundaries.


Using more grid points or a smaller field of view will always improve the picture, as will arranging for grid points to lie on electrode surfaces where this is possible. Despite appearances the electrodes are in fact almost exact equipotentials in the sense that in the Boundary Element Method (see chapter 1) the potentials at the mid-points of the segments (that is, the subdivisions), derived from the surface charges, are exactly (that is, within the requested inaccuracy) the potentials applied to the segments.


In this respect the Boundary Element Method therefore differs from the Finite Difference and Finite Element Methods (also known as 'grid' methods), in which the grid points for the contours are identical to the mesh points used to find the field, and some of the mesh points automatically lie on the electrodes.


Therefore in regions very near to an electrode (more precisely, at points nearer to a segment than the width of the segment) there is a tendency for the inaccuracy to be worse than the requested value. The program uses a technique to improve the potentials in these circumstances, but this requires extra computing time. This technique for improvement can be disabled (and time saved) by clicking on faster calculation but less accurate near relectrodes. (The technique is automatically disabled when the option to import charges is in use or when dielectrics are present.) See also notes on potentials, fields and contours near to boundaries.


Some queries can arise when there are some electrodes at a very high potential (for example an anode at 100kV) but the potentials in a region of low potential (for example near a cathode) are being investigated. The following is an extract from chapter 4:

There are some electrodes at a high potential (for example an anode at 100kV) but the potentials in a region of low potential (for example near an cathode) are inaccurate. This can happen when the chosen inaccuracy is not small enough, because the errors are of the order of the highest voltage times the chosen inaccuracy. Comment: This does not necessarily affect the ray tracing, because all the potentials in the cathode region are usually wrong by the same amount.

The potentials at the middle points of the segments are not exactly equal to the applied potentials, which appears to disagree with the principle of the Boundary Element Method, as described in chapter 1. This can happen when the inaccuracy chosen for the potentials is not the same as the inaccuracy used by the program for calculating the charges (that is, the minimum inaccuracy, at present 0.000001).


Field contours:


The electrostatic field in the vicinity of the surface of a solid electrode changes suddenly from having a finite value outside the surface to a zero value inside. Similarly the field due to a sheet of charge (on a thin electrode) changes direction on passing through the sheet. The field contours in such regions will therefore be dense, and perhaps irregular.


Space-charge density contours:


When space-charge cells are in use the space-charge density is taken as the density inside the local cell.

When space-charge tubes are in use an ‘averaging radius’ has to be entered in one of the boxes on the screen. Great care should be taken in choosing the value s of this parameter. In CPO3DS the program finds the charge inside a sphere of radius s. In CPO2DS the density at a point (r,z) is deduced from the charge between two cylinders that are centred on the axis and have radii r-s/2 and r+s/2 and length s. If the value of s is chosen to be too small then the number of rays inside the defined volume might be small or zero, in which case the values deduced for the space-charge density might fluctuate wildly from point to point. On the other hand if s is too large then the density will be averaged over a correspondingly large volume, in which case local variations might be attenuated. Note that this problem can be avoided for the space-charge densities evaluated by the program during ray tracing, because the averaging radius can be adjusted to suit the local conditions and also the radii of the space-charge tubes can be changed.


The density is in Coulomb per cubic metre.



The space-charge density in the cathode region is not included.

When space-charge tubes are in use the space-charge density is inaccurate near the edges of a beam and near electrodes, because at each point it is averaged over the sphere of radius s mentioned above.


Current density contours:


This option is only available in CPO3DS and can only be used with the space-charge tube option.

It is based on the option for space-charge density contours, the details of which are given above.

The current density is in Amperes per square metre.


Potentials and fields in external regions:


If the program is asked to calculate potentials or fields in regions that are external to an unbounded system of electrodes (for example the region outside the spheres in the test files test2d01.dat and test3d01.dat) then the results will depend on whether the 'zero total charge' option is in use. If it is in use the external potential will be constant and the field will be zero, because the program will have used an unseen offset voltage that causes the total charge on all the electrodes to be zero. On the other hand if the option has been disabled the external potentials will decrease with distance from the electrodes, in the expected way.



Repeat of the information in section 3 of chapter 5:

Contour: this option gives 2D contour plots of potentials or electric fields or (for CPO3D and CPO3DS only) magnetic fields. In the case of potentials, a colour or a conventional contour plot can be chosen, while with electric or magnetic fields a further option of vector plots is added. Another option also exists for potentials and fields -to put numerical values on a grid into the output data file, instead of displaying contours.

The user can define the numerical limits of the field of view, to exclude unphysical exterior regions.

To generate the contours the program uses N*N equally spaced grid points and calculates the values of the potential or field components at each point. The program will ask for the value of N, the inaccuracy of the calculation (for which the 'direct' method is used) and the coordinate of the contour plane in the non-viewing direction. After calculating the values at the grid points the program will ask for the number of contours and their lower and upper limits.

In the conventional contour plots every fifth contour is coloured. In all the types of plot the Mouse can be used to scan the potential or field components. Two sets of information are displayed on the bottom bar -the values of the potential or field components at the nearest grid point (which appears as a small box on the plot) and the interpolated values at the position of the cursor. (The interpolated values are obtained by bilinear interpolation using the nearest 4 grid points). The units for the electric field are V/mm.

If any difficulty is encountered in clearing the contour screen, use Nonzoom.


Lost contours: See section 3 of chapter 5 of the Users Guide.


Footnote 1: The 'direct' method is used even if the 'mesh' method was used in the main program, because of the possibility of a serious mis-match between the grid spacing dg for the present contours and the mesh spacing dm used in the main program. In particular if dg is much smaller than dm then detailed contour information would not appear.