# Magnetic Field Solvers

## TBMG-35

## 09/01/2006

- Content
The Magnetic Field Solver computer program calculates the magnetic field generated by a group of collinear, cylindrical axisymmetric electromagnet coils. Given the current flowing in, and the number of turns, axial position, and axial and radial dimensions of each coil, the program calculates matrix coefficients for a finite-difference system of equations that approximates a two-dimensional partial differential equation for the magnetic potential contributed by the coil. The program iteratively solves these finite-difference equations by use of the modified incomplete Cholesky preconditioned-conjugate-gradient method. The total magnetic potential as a function of axial (z) and radial (r) position is then calculated as a sum of the magnetic potentials of the individual coils, using a high-accuracy interpolation scheme. Then the r and z components of the magnetic field as functions of r and z are calculated from the total magnetic potential by use of a high-accuracy finite-difference scheme. Notably, for the finite-difference calculations, the program generates nonuniform two-dimensional computational meshes from nonuniform one-dimensional meshes. Each mesh is generated in such a way as to minimize the numerical error for a benchmark one-dimensional magnetostatic problem.

- Citation
- "Magnetic Field Solvers," Mobility Engineering, September 1, 2006.