in which case can a magnetic field be produced?