The 'User-defined stochastic scattering' version
Disclaimer:
Since writing this code and using it successfully to simulate Boersch energy spreading, it has been realized that the code cannot be guaranteed to work well for the wider range of problems involving stochastic effects.
Please bear this in mind when reading the description below.
This version of the 3D programs allows stochastic scattering (ie individual electron‑electron or ion‑ion Coulomb interactions) of the particles, using a User-supplied routine. It allows accurate calculations of effects such as Boersch energy spreading or spatial blurring, for any shape or size of beam and with no significant approximations or assuptions having to be made. The version is available in a special version of the CPO3DS program -contact CPO Ltd at: [email protected]
The version is essentially the same as the scattering version, except that additional data is sent to the User-supplied routine to enable that routine to simulate stochastic scattering. The additional data includes:
(1) the local space-charge density in the vicinity of the mid-point of the present trajectory integration step,
(2) the velocity components of the 10 trajectories that are nearest to the present trajectory,
The technique is described in the paper by F H Read and N J Bowring, Rev. Sci Instrum, 74 (2003) 2280-2287 and later papers.
An example data file is xmpl3d60.
At the end of each step in the trajectory integration the program sends information (the coordinates, velocity components, potential, time) to the user-defined routine, as in the scattering option. But now the program also sends the value of the local charge density, as follows:
(1) The program calculates the average space charge density at the start of each trajectory step.
(2) When the space charge cell method is in use the density is the density in the relevant cell.
(3) When the tube method is in use:
The program averages the density over a sphere of radius R that surrounds the starting point.
The user specifies the value of R.
The program will not allow R to be less than the tube radius.
(4) Also see the warnings given for space charge density contours.
The program expects a return giving new velocity components or an instruction to terminate the trajectory.
The user-defined routine can call upon a data file that contains controlling data. The user is asked to specify the name of this file.
The user-defined routine can also output information to a file that is named in the routine.
An example of a suitable user-defined routines (in C++) is given in sct3coul.cpp, which is supplied with the CPO package. This file also contains detailed comments on the technique.
The stochastic option can be combined with other types of scattering:
(1) Combining stochastic scattering with global space-charge spreading.
The user can use a series of 'n' global space-charge spreading iterations followed by a series of 'm' stochastic scattering iterations. Either n or m can 0 or 1. The global spreading usually produces the greatest changes to the beam profile, so this option allows it to be dealt with before the stochastic scattering is looked at.
Firstly a sufficient number of the normal space-charge iterations should be carried out to give an acceptably consistent beam. The space-charge repulsion in the beam in these iterations is non-stochastic. Then the stochastic scattering should be switched on: the user specifies (in databuilder) the number of the iteration at which the stochastic scattering starts. Typically, stochastic scattering would be switched on only for the final iteration. See xmpl3d60.
The restriction that the rays should cross the first test plane is automatically disabled.
(2) Combining with thin lens action.
See xmpl3d68.
Technical details.
At the end of each step in the trajectory integration the program sends information to the user-defined routine and expects a return giving new velocity components or an instruction to terminate the trajectory. The information that is sent is the same as in the scattering version (that is, the coordinates, velocity components, potential, time) plus the local charge density and the velocity components and distances away of the 10 nearest trajectories. This additional information can be used, in a user-supplied routine, to simulate randomised electron-electron scattering. An example of such a routine (called sct3coul.cpp) is given.
The user is asked (in databuilder) to specify the local radius over which the local space-charge density is averaged. This radius defines a sphere that is centred at the mid-point of the present trajectory step. All space-charge tubes that are wholly or partly within this sphere are used to calculate the space-charge density in the sphere. For this purpose each space-charge tube is treated as a line of charge, so that the length of the line that is within the sphere can be used. An ‘advance option’ is available for changing the averaging radius during trajectory integration.
The stochastic option can only be used in conjunction with the space-charge tube method.
The user-defined routine can call upon a data file that contains controlling data. The user is asked (in databuilder) to specify the name of this file.
The user-defined routine can also output information to a file that is named in the routine.