Analysis of Magnetic Fields by the Finite Element Method