Abstract
Equilibrium configurations of the internal magnetic field of a pulsar play a key role in modelling astrophysical phenomena from glitches to gravitational wave emission. In this paper, we present a numerical scheme for solving the Grad–Shafranov equation and calculating equilibrium configurations of pulsars, accounting for superconductivity in the core of the neutron star, and for the Hall effect in the crust of the star. Our numerical code uses a finite difference method in which the source term appearing in the Grad–Shafranov equation, which is used to model the magnetic equilibrium is non-linear. We obtain solutions by linearising the source and applying an under-relaxation scheme at each step of computation to improve the solver’s convergence. We have developed our code in both C++ and Python, and our numerical algorithm can further be adapted to solve any non-linear PDEs appearing in other areas of computational astrophysics. We produce mixed toroidal–poloidal field configurations, and extend the portion of parameter space that can be investigated with respect to previous studies. We find that in even in the more extreme cases, the magnetic energy in the toroidal component does not exceed approximately 5% of the total. We also find that if the core of the star is superconducting, the toroidal component is entirely confined to the crust of the star, which has important implications for pulsar glitch models which rely on the presence of a strong toroidal field region in the core of the star, where superfluid vortices pin to superconducting fluxtubes.