Magentic field computation