Rapid simulation of permanent magnet drives