# Simplified Optimization of the Magnetic Configuration of HEMP-Thrusters
## 2 Materials and Methods
### Numerical Analysis of Field Lines  
For a set of radius \(R\) and length \(L\) of the permanent magnetic ring, the magnetic field is evaluated at \(400\times 400\) points in the (\(r\),\(z\))-plane. The magnetic field of a ring magnet of finite width of \(2\,\mathrm{mm}\) is calculated by the Python library magpylib [10] and is used to verify the results. The Jupyter notebooks are hosted on [15]. The library can solve the magnetostatic problem of a cylinder [16; 17] with magnetization \(\mathbf{M}\) analytically. Two cylinders of different polarity and radius but the same strength result in a ring-shaped magnet, where the smaller cylinder is inscribed within the larger one. This is allowed due to the superposition of magnetic \"charges\" \(\
abla\mathbf{M}\). The problem is equivalent to an electrostatic case with a charge density at the front surface. The strength of the magnetization \(\mu_{0}M\) is set to \(1\,\mathrm{T}\), which is about the order of rare earth magnets. This approach is very attractive for optimization because finite element solvers for magnetic fields require much longer run times. In addition, the conservation properties of the resulting fields (divergence-free, etc.) are better with analytical methods. This minimizes numerical errors from such fields, e.g., in PIC codes [18; 19]. Divergent contributions from numerical field solvers are a big concern for such codes, because they produce artificial drifts and forces. In Figure 3a-c the field lines of the magnetic flux \(\mathbf{B}\) for three different geometries (R,L) are plotted. The origin of the coordinate system is the same as in the sketch of the analytical derivation. The three geometries have varying lengths (a) \(L=10\,\mathrm{mm}\), (b) \(L=50\,\mathrm{mm}\), and (c) \(L=90\,\)mm with fixed radius \(R=20\,\)mm. The magnetic flux \(\mathbf{B}\) is depicted as a stream plot in blue. For the different lengths of the ring magnet, the extent of the field lines in axial direction varies greatly. A marker (\(\bullet\)) tags the maximum \(z\) coordinate of the separatrix \(z_{sep}\) in Figure 3, which will be discussed in more detail. In order to better understand the distribution of field lines, each plot contains 20 selected \(\mathbf{B}\) field lines, which are traced from the starting points (\(r_{0},z=0\)) towards the wall. These field lines are displayed in red. The initial radial position \(r_{0}\) is varied in order to scan the whole domain, which is later used for the measures of the magnetic field \(\mathbf{B}\). Here, only half of the ring magnet is shown, since the field is also symmetric with respect to the \(z=0\) axis. The tracing of the field lines was formulated as a system of discretized ordinary differential equations (ODE) where the vector of the magnetic field \(\mathbf{B}\) is the vector of the derivative so that the ODE solver of the Python scipy package can be used. The paths of the 20 field lines, which are picked, are integrated until they hit an ideal wall at \(r=R\). For that purpose, the field between the analytical grid points was interpolated linearly. Field lines that exceed the length \(L/2\) of the thruster ring also stop at the ideal wall \(r=R\). Normally, the magnetic rings are covered by dielectrics and metals so that the radial and axial extent is usually larger. This justifies the ideal wall condition. For a starting point close to the axis, a ratio of radial to the total magnetic field \(\sin(\alpha)=B_{r}/B\) is averaged over analytical sampling points in the vicinity of the origin within the box area (\(r\leq 0.1\cdot R,z\leq 0.1\cdot L\)). The result is shown in Figure 4. Close to the center of the ring magnet, the radial magnetic field \(B_{r}\) is small compared to the total magnetic field \(B\). The zero radial field, equivalent to only axial parallel magnetic field, is reached in agreement with the analytical result derived before; i.e., the root of \(\sin(\alpha)\) is very close to the analytical result, denoted by the olive vertical bar in the figure.