  When a star gets tidally disrupted by a supermassive black hole, its magnetic
field is expected to pervade its debris. In this paper, we study this process
via smoothed particle magnetohydrodynamical simulations of the disruption and
early debris evolution including the stellar magnetic field. As the gas
stretches into a stream, we show that the magnetic field evolution is strongly
dependent on its orientation with respect to the stretching direction. In
particular, an alignment of the field lines with the direction of stretching
induces an increase of the magnetic energy. For disruptions happening well
within the tidal radius, the star compression causes the magnetic field
strength to sharply increase by an order of magnitude at the time of pericentre
passage. If the disruption is partial, we find evidence for a dynamo process
occurring inside the surviving core due to the formation of vortices. This
causes an amplification of the magnetic field strength by a factor of $\sim
10$. However, this value represents a lower limit since it increases with
numerical resolution. For an initial field strength of 1 G, the magnetic field
never becomes dynamically important. Instead, the disruption of a star with a
strong 1 MG magnetic field produces a debris stream within which magnetic
pressure becomes similar to gas pressure a few tens of hours after disruption.
If the remnant of one or multiple partial disruptions is eventually fully
disrupted, its magnetic field could be large enough to magnetically power the
relativistic jet detected from Swift J1644+57. Magnetized streams could also be
significantly thickened by magnetic pressure when it overcomes the confining
effect of self-gravity.
