Formation of a flux core spheromak