Global magnetohydrodynamic magnetosphere simulation with an adaptively embedded particle-in-cell model