Dynamical grid method for time-dependent simulations of axisymmetric instabilities in tokamaks