Simulation of magnetic switching action in high-power systems