A finite element method to compute three-dimensional magnetic field distribution in transformer cores