Numerical study of the partitioning of magnetic field energy and plasma energy during the penetration of the magnetic field into the plasma