Physics of magnetic flux ropes