In this paper, we study the dynamics of the Bose-Hubbard model by using
time-dependent Gutzwiller methods. In particular, we vary the parameters in the
Hamiltonian as a function of time, and investigate the temporal behavior of the
system from the Mott insulator to the superfluid (SF) crossing a second-order
phase transition. We first solve a time-dependent Schr\"odinger equation for
the experimental setup recently done by Braun et.al. [Proc. Nat. Acad. Sci.
112, 3641 (2015)] and show that the numerical and experimental results are in
fairly good agreement. However, these results disagree with the Kibble-Zurek
scaling. From our numerical study, we reveal a possible source of the
discrepancy. Next, we calculate the critical exponents of the correlation
length and vortex density in addition to the SF order parameter for a
Kibble-Zurek protocol. We show that beside the "freeze" time t^, there
exists another important time, teq, at which an oscillating behavior
of the SF amplitude starts. From calculations of the exponents of the
correlation length and vortex density with respect to a quench time \tQ, we
obtain a physical picture of a coarsening process. Finally, we study how the
system evolves after the quench. We give a global picture of dynamics of the
Bose-Hubbard model.Comment: References added. Version to appear in Phy.Rev.