Magnetic Field Calculation and Applications