Global dynamics of the plasmasphere and ring current during magnetic storms