Current generation in tokamaks by phased injection of pellets