Accurately predicting electron beam deflections in fringing fields of a solenoid

Computer modelling is widely used in the design of scientific instrumentation for manipulating charged particles, for instance: to evaluate the behaviour of proposed designs, to determine the effects of manufacturing imperfections and to optimise the performance of apparatus. For solenoids, to predict charged particle trajectories, accurate values for the magnetic field through which charged species traverse are required, particularly at the end regions where fringe fields are most prevalent. In this paper, we describe a model that accurately predicts the deflection of an electron beam trajectory in the vicinity of the fringing field of a solenoid. The approach produces accurate beam deflection predictions in the fringe field region as well as in the centre of the solenoid. The model is based on a direct-line-of-action force between charges and is compared against field-based approaches including a commercially available package, with experimental verification (for three distinct cases). The direct-action model is shown to be more accurate than the other models relative to the experimental results obtained.


Mathematical model
Three different models which predict the deflection of an electron beam passing across a solenoid in any field region are presented and explained in this section: (i) the standard (i.e., conventional) model following the fieldbased approach of electrodynamics (Sect. 'Field model') where the interaction of all charged particles is based on the Maxwellian theory of electric and magnetic fields [28][29][30] ; (ii) a numerical model based on field theory (Sect. 'Modelling with CPO') from the software package CPO 22 , which is used to calculate beam trajectories based on the Boundary-Element-Method (BEM); (iii) our model (Sect. 'Weber model') which employs the theory of direct action at a distance between the particles and is based on Weber electrodynamics, where the concept of field entities E & B and their mediation is avoided. In this paper, we develop a new model based on the Weber force equation to predict the trajectory of an electron beam and its deflection accordingly. Recently, there has been increased research interest in Weber-based electrodynamics, where the theory has been related not only to electron beam deflection 37,38 , but also to induction 39,40 , superconductivity 41,42 as well as the Planck-constant 43,44 and the structure of the atom 45,46 . First, the Weber-based model will be explained in the following section.
Weber model. The model we present follows the direct action approach laid out by Weber 47 , where he published his findings 15 years prior to Maxwell's theory 48 of fields and aether. The interaction of charged particles according to Weber is determined by the Weber-force equation, that depends on the relative displacement r 12 , relative velocity ṙ 12 and relative acceleration r 12 between the charges q 1 and q 2 , where ε 0 is the permittivity of free space and c is the speed of light. In this formulation we have along with the magnitude and unit vector in equation (6).
The Weber force acts along the line joining the particles and reduces to the Coulomb force for charges at rest. It is also consistent with the field equations of Maxwell [49][50][51][52] , although it does not depend on them conceptually, as it is a direct-action approach where a form of mediation is not needed to transmit the force between charges. Based on this force approach a model has been derived in an earlier work 37 for the deflection of electrons across a single current loop, but to apply this to the fringing field regions, significant refinements have been added to the simplified two dimensional (2D) model of 37 , especially to account for the three dimensional (3D) nature, taking the geometry of the particular solenoid into account. As a first step, however, a single current loop can (2) � F 21 = q 1 q 2 4πε 0r 12 r 2 12 1 −ṙ 2 12 2c 2 + r 12r12 c 2 (3) � r 12 =� r 1 − � r 2 (4) r 12 = dr 12 dt Scientific RepoRtS | (2020) 10:10903 | https://doi.org/10.1038/s41598-020-67596-0 www.nature.com/scientificreports/ be assumed in a 2D plane, where the electron beam is traversing across the solenoid at a fixed height, h, in the positive x-direction with a velocity, v 1 , giving it a position, r 1 , as shown in Fig. 1a.
The current, I, is situated at a position, r 2 , and rotating here in a positive mathematical sense, with a velocity, v 2 , around the loop with a radius, R, so that it can be represented by a current element, IRdθ . It is important to note that the rotational direction of the current is regarded as the actual physical motion undertaken by the electrons in the current element, so it is in opposition to the conventional current flow, and rather sticks to the physical direction of current flow.
As a next step the model is now extended to 3D space, with the coordinate system being centred in the solenoid, with the solenoid axis elongating from − l 2 to l 2 . For the experiments, the solenoids used are all double wound with a given number of windings, and to take the double wound manufacturing into account in the model, the force is split into an inner and outer component, F i and F o , respectively, with a coil radius of R i and R o which are about the same, R i ≈ R o . We assume that the electron-current is fed to the solenoid at the position z 2 = l 2 to one layer of the winding, so that it moves towards z 3 = − l 2 and is then returning through the other layer towards z 2 , as depicted in Fig. 1b.
This behaviour can be modelled in two ways, one is a helical motion following the pitch of the windings and the other one is a summation model, where each winding is assumed as a single current loop at a given position and the principle of superposition is used to summate the force contribution from each individual loop. For the helical model the current is then changing its axial position, depending on the pitch with dz · θ , either in a positive or negative sense, depending on where the current is fed and returned to. The corresponding velocity increase along the axis is derived as v 2 R dz and the relational position, r 12 , and velocity, v 12 , are defined as: It is further assumed that the acceleration is negligible for the given experimental setup, as the electrons in the beam are moving at a constant speed after the initial acceleration phase and the acceleration that is exerted on the current element due to the helical motion is sufficiently small. In order to calculate the resulting force between the beam and the current in the solenoid a superposition of all the charges involved must be performed. Physically, the electrons in the beam are interacting with the To evaluate the total force exerted by the solenoid on the beam, we can assume that while the continuous current is flowing, a current element is immediately replaced with the next. The transformation qv → v → IRdθ then holds the total force for integrating over the complete solenoid. This yields force equations for both Weber-based models, where N is the number of turns in one layer. From both of these equations it is evident that the model predicts three kinds of forces on the beam: a longitudinal force, a vertically transversal force and a horizontally transversal force. The beam will then be deflected in the y-direction due to the transverse (vertical) force and in the z-direction due to the (horizontal) transverse force. Therefore the impulse of the force is calculated with the time, t, that the beam spends travelling from the anode to a fluorescent screen (that is excited upon electron collision) on which the deflection is recorded.
Equating this to the change of vertical and horizontal momentum, where m e is the electron mass and v h , v v are the horizontal and vertical velocities gained from the deflection force, the total deflections can be calculated as, In order to accurately predict these deflections, they have been simulated in Matlab (Mathworks) with numerical integration based on the trapezium rule to an accuracy of 0.1 mm for the spatial beam propagation and 0.5 • for the integration step size. The simulations show that the helical and summation approach both arrive at the same force for the respective direction, which was anticipated, given the chosen modelling approach. It also serves to verify the choices made to model the axial elongation of the solenoid. Further to this, the longitudinal force acting along the beam is found to be zero, which is in agreement with the Lorentz-force vector. On the other hand, the deflections occurring transversal to the beam are both expected due to the vector cross product � v × � B in the Lorentz-formula, as will be seen clearly in the field-based model in the next section. From this model it can also be deduced that the direction of deflection depends on the rotational direction of the current, which in the standard field model determines the magnetic field direction and thus the corresponding deflection. Here we can find a deflection of the beam in the positive y-direction and negative z-direction for mathematically positive rotating electrons and in the case of negative rotation, the deflection occurs in negative y-and positive z-direction. This is consistent for the expected vertical deflection direction from the right-hand-rule, respectively left-hand-rule in the standard field based approach, which will be examined next.
Field model. For the calculation of the magnetic field a Matlab code by D. Cébron is used 28 which is based on the work of Derby and Olbert 30 and Callaghan and Maslen 29 . The latter is contained in a technical note from NASA, in order to calculate the fields inside and outside of any finite solenoid or magnet. This simulates the radial component, B ρ , and the axial component, B z , based on the residual field, B res = µ 0 n unit I , with n unit being the number of turns per unit length, and then solving the complete elliptic integrals for the magnetic fields. These are 28 : where K and E are the complete elliptic integrals of the first and second kind and with ξ ± = z ± L/2 . Then the following definitions are made for the axial magnetic field, The axial field is then for ζ + < 1 and for ζ ± 1 with being the complete elliptic integral of the third kind. The total calculated field strength with this approach can be seen in Fig. 2 which has been simulated with the same accuracy as in the 'Weber model' section. The white lines in the Figure, situated at ±R , are where the algorithm used did not converge.
Next, to perform the vector cross product and deduce the deflection along the y and z axes, we convert the field to Cartesian coordinates at an angle of θ = 3 2 π as the beam passes below the solenoid. Thus and we can get the deflecting force (20)  F L and the deflection is obtained by using r L ± r 2 L − d 2 , where d is the travel distance of the beam and the sign depends on the direction of deflection. Apart from that, an impulse approach was also used to calculate the deflections, where the force acting on the beam has been calculated following the beam trajectory, starting from the position where the Larmor radius is obtained to the point where the beam is intercepted by the fluorescent screen. Thus, the local force is obtained with the same granularity as in the previously described model. The forces can then be integrated according to Eq. (18) and the final deflection is again obtained using Eq. (20). Both Larmor radius and impulse approach then give the same results for deflections in the y and z directions. Additionally, the model by Farley and Price 53 to roughly estimate the field of a finite solenoid has also been used to check the deflection at the position z 1 = 0 when the beam is centred across the coil. This model however, can only predict the vertical deflection at that specific point as it was not designed for inhomogeneous fields.
Modelling with CPO. Finally, the deflections across the solenoid are also modelled with state-of-the-art commercially available software CPO 22 . Here the solenoid is modelled as a stack of current loops, which is one of the two standard methods available in the software. Following the geometries shown in the 'Experimental setup' section, the solenoid is set to elongate on the z-axis and with the coordinate origin aligning with the centre of the solenoid. A current of 1.00 A is supplied to rotate in the mathematically negative sense, which represents positive rotation of the electrons moving through the solenoid. The beam going across the solenoid is seen as individual rays of electrons and traced with the direct method. Both the databuilder file that is used to implement the experimental setup and the field that is generated by the software (see Fig. SF1) are given in the supplementary information. The simulation results to model electron beam deflection across a solenoid from these three models can be found in Tables 2 and 3 in the 'Results' section, where they are also compared to the experimental results.

Experimental setup
A sketch of the relatively simple experimental setup is shown in Fig. 3, depicting an electron beam (from an electron gun) which is deflected across the current carrying solenoid and then strikes a fluorescent screen. The electron gun and the fluorescent screen were adapted from a Hameg 203-6 cathode ray oscilloscope, so that www.nature.com/scientificreports/ the solenoid can be located across the electron beam, at right angles to the electron beam. The circuitry of the oscilloscope has been modified into a control unit that connects to the electron gun through an external cable. The electron gun tube operates at an acceleration voltage of 2000V, which gives the electrons a terminal velocity of after passing the anode, at a distance of 7 cm from emission. Propagating in a straight line the fluorescent screen is then intercepted after another 21.5 cm of beam travel. The glass evacuated tube enclosing the electron gun has a diameter of 50 mm and the solenoid sits on top of it, at a distance of 3 cm from the anode. For our choice of coordinates, the beam propagates at a height h = −(25 + R) mm and travels 18.5 cm from the coordinate origin to the fluorescent screen with this arrangement.
The phosphor screen has a graticule divided in 10 mm steps, with subdivisions of 2 mm that give a rough indication of where the beam is intercepted by the screen after the deflection. The spot left by the beam can be focused to a size of roughly 1 mm in diameter and is indicated by the green coloured spot in Fig 3. To deflect the beam, three different solenoids are used: length 25 mm (S1), length 255 mm (S2) and length 500 mm (S3), with different radii and numbers of windings, as documented in Table 1. By definition, the shortest solenoid with 25 mm length can be considered as a 'coil' , but will be further referred to as solenoid S1. A continuous DC-current of 1.00 A is supplied to the solenoid with a benchtop power supply.
The solenoids are set in such a way that the beam is deflected at different positions relative to the coordinate origin, so that the beam crosses different regions of the field, which are getting increasingly more fringing closer to the solenoid ends. For the shortest solenoid, it is first set for the beam to cross at z 1 = 0 , per se at the middle  www.nature.com/scientificreports/ of the solenoid length and then moved in steps of one quarter of the length towards the edge of the solenoid, so that it passes at z 1 = l 4 and then at z 1 = l 2 where it is aligned with the end of the solenoid on the z-axis. The solenoid is then moved for the beam to be positioned at z 1 = 3l 4 and z 1 = l , while the solenoid is kept at the same height. At these points the beam is not crossing the coil directly any more, as it sits at a distance further from the origin than the solenoid's axial elongation. These positions are also implied in Fig. 3 for a visual representation of where the beam is travelling in relation to the solenoid origin.
For the two longer solenoids, S2 and S3, the beam is set in 1 8 steps of the solenoid length from the centre position, z 1 = 0 , up to the point z 1 = 3l 4 which are again shown in Fig. 3. Especially at the positions around z 1 = l 2 , it is said that the field is fringing and strongly deviates from the ideal homogeneous field associated with an infinite solenoid. Furthermore, the shortest coil, S1, will have a very inhomogeneous field according to theory due to its length and radius being almost the same, with a relatively small number of windings.
To obtain measurement of beam deflections the following procedure is adopted. The solenoid is located at a given position across the e beam which is then focused and centred in the middle of the screen. The solenoid current is now switched on and adjusted to provide a magnitude of 1.00 A; the beam deflection is noted. The deflection on the screen is acquired with a plastic vernier along with the help of the graticule on the screen; immediately after the power supply is switched off. The procedure is repeated 3 times in order to acquire a mean deflection for the beam spot.

Results and discussion
The beam deflections measured in the vertical and horizontal directions across the three solenoids are summarised in Figs. 4, 5 and 6. Figure 4 shows the measured deflection in the y and z direction along with the predictions from the different models for solenoid S1; similarly, Fig. 5 shows S2 and Fig. 6 shows S3. The experimental data is shown in blue squares for each of the beam positions and has corresponding predictions from the Weber-type model (red x), the field based model (yellow triangle) and numerical field model using CPO (purple circle). The data points of the measurements are labelled with the respective beam positions on the z-axis where the solenoid was crossed, starting from l = 0 . The size of the four data points for a specific position are the same such that the predictions can be related to the relevant experimental data point for a given position.
It can be seen very clearly in Fig. 4 that the overall trend and deflection positions for the inhomogeneous field of the short solenoid S1 are met well with the theoretical predictions from the Weber model. By contrast, calculations based on the field model show a greater departure from measurement, as it overestimates the deflection. The results from CPO are closer to the experimental values than the analytical field model, but the deflection values are underestimated in this case.  www.nature.com/scientificreports/ Similarly, as indicated in Fig. 5, deflections across solenoid S2 tend to be consistent with all three models; note the change in sign for the vertical deflection once the beam has been moved past the edge of the solenoid, where z 1 > l 2 . Except for positions 3l/8 and 5l/8 where field theory predicts close agreement with measurements, the Weber-based model predicts deflections closest to the experimental values and CPO tends to underestimate the displacement. However, for the fringing field region at l/2 the field model greatly overestimates the horizontal deflection, whereas the direct model provides an accurate prediction and CPO also gives a close estimate. Figure 6 shows the data for the longest solenoid S3; a similar behaviour at l/2 is observed with the field model. Again it overestimates the horizontal deflection by a noticeable margin compared to the direct action prediction and CPO, which give a much closer result. Looking at the positions 3l/8 and 5l/8, the deflections are underestimated by the field model and CPO alike, while the direct action model is closest to the experimental measurements. Still the general trend of deflections with the sign change in vertical deflection past the edge of the solenoid is followed by all three of the models.
For the non-fringing region at z 1 = 0 to l/4 the vertical deflection is underestimated for the two longer solenoids and overestimated for S1 in the field-model, whereas CPO seems to generally underestimate the deflections. The predictions of the Weber model are closer to the experimental values in most cases. This is in agreement with the earlier work on this topic 37 where a uniform field was assumed for the vertical deflection according to the model of Farley and Price 53 .
It is interesting to note that in the field-based model, the part of the magnetic field responsible for the vertical deflection is the axial component B z , whereas the radial component B ρ , respectively B y in Cartesian coordinates, is responsible for the horizontal deflection, due to the vectorial cross product in the Lorentz force formula. In contrast, the direct-action model according to Weber predicts the deflection by the respective force component along that direction, the y-component of the force is thus responsible for the vertical deflection and the z-component is responsible for the horizontal deflection. It might well be possible to relate the Weber force components to the magnetic field strength in the future. Despite that conceptual difference, all three models can predict the deflection within a certain accuracy, although our investigation shows that, for this specific setup, the direct-action model seems to deliver the most accurate results.
For complete comparison, Tables 2 and 3 show the mean of the experimental data and the simulation results for each of the models. For the vertical deflection at l = 0 the Farley and Price model (F&P) is also included for consistency, but this model cannot predict the other deflections.
It can be seen from these Tables that in the F&P model the electron beam does not reach the fluorescent screen after being deflected by the shortest solenoid, because the produced field deflects the beam too much in this model. Also it is apparent from the data that the beam is deflected to the opposite vertical direction for S2 and S3 at the points 5l/8 and 3l/4 and each model correctly predicts the change in sign.
The Table only shows the experimental and simulation data for mathematically positive rotating electrons (which is negative rotation in terms of conventional current flow); changing the direction of current flow will invert the deflection directions, in the experiments as well as in the models. So the three models, respectively both field theory and direct-action-at-a-distance theory agree on the same trend that is seen for a deflection in the fringing fields of finite solenoids. The relative accuracy of the compared models can be obtained according to Eq. (31):  Figures SF2-SF10), which also includes the total deflection ζ = y 2 d + z 2 d depicting the polar equivalent of deflection magnitude.

Conclusion
The deflection of an electron beam across three differently sized solenoids has been tested experimentally and was predicted with three distinct models. One is a field theory model based on the equations of Maxwell and Lorentz, the second is a field based numerical model, from a commercial software package, which utilises the boundary element method and the third is a direct-action-at-a-distance-theory based on the Weber force. It was found that, in general, for the limiting condition v ≪ c in the low velocity regime, the experimental data has good agreement with the Weber-based model. Especially for the shortest solenoid S1 (25 mm length) where the field is non-uniform, the field model is significantly overestimating the deflection and, to a lesser extent, the numerical field model is underestimating. For the two longer solenoids, S2 (255 mm) and S3 (500 mm), where the field is slightly more uniform, the direct-action model produces overall the most accurate predictions. However, all models follow the observed trend and overall the Weber model is found to be 91.7% accurate relative to the experimental data.
The Weber theory is based on minimal assumptions compared to the field approach, as it does not directly involve the calculation of field entities B and E , nor leakage flux or vector potential. It offers the more accurate predictions, for this particular case, by directly calculating the forces involved. This makes it especially interesting from an engineering point-of-view, as it bypasses the calculation of the field and provides the electromagnetic force directly.
The present investigation raises of course the question for the behaviour of charged particles in the higher velocity regimes, when the movement is approaching the speed of light, where the field model with the Lorentzcorrection factor is experimentally proven to deliver accurate results. The problems with the direct-action theory in this case have been discussed 54 and attempts have been made to amend the theory 55 to reflect better the behaviour of fast moving charges and the matter is still subject to recent investigation 38 . Nevertheless this shows that both theories hold certain benefits and drawbacks that can be used advantageously depending on the situation as we consider that both approaches complement each other. As we are limiting the present investigation to the low velocity regime, the results could be relevant for several applications in the field of charged particle dynamics, not limited to charge guidance by solenoids.