Magnetic fields reduce defects in 3D-printed metal components