  Spontaneous spin vortex formation in the magnetic phase transition of a
trapped spin-1 Bose-Einstein condensate is investigated using mean-field
theory. In a harmonic trapping potential, an inhomogeneous atomic density leads
to spatial variations of the critical point, magnetization time scale, and spin
correlation length. The Kibble-Zurek phenomena are shown to emerge even in such
inhomogeneous systems, when the quench of the quadratic Zeeman energy is fast
enough. For slow quench, the magnetized region gradually expands from the
center of the trap pushing out spin vortices, which hinders the Kibble-Zurek
mechanism from occurring. A harmonic trap with a plug potential is also taken
into account.
