MHD simulations of magnetotail dynamics