Numerical simulations of a planetary magnetosphere