  We present axisymmetric hydrodynamical simulations of the long-term accretion
of a rotating GRB progenitor star, a "collapsar," onto the central compact
object. The simulations were carried out with the adaptive mesh refinement code
FLASH in two spatial dimensions and with an explicit shear viscosity. The
evolution of the central accretion rate exhibits phases reminiscent of the long
GRB gamma-ray and X-ray light curve, which lends support to the proposal that
the luminosity is modulated by the central accretion rate. After a few tens of
seconds, an accretion shock sweeps outward through the star. The formation and
outward expansion of the accretion shock is accompanied with a sudden and rapid
power-law decline in the central accretion rate Mdot ~ t^{-2.8}, which
resembles the L_X ~ t^{-3} decline observed in the X-ray light curves. The
collapsed, shock-heated stellar envelope settles into a thick, low-mass
equatorial disk embedded within a massive, pressure-supported atmosphere. After
a few hundred seconds, the inflow of low-angular-momentum material in the axial
funnel reverses into an outflow from the surface of the thick disk. Meanwhile,
the rapid decline of the accretion rate slows down, or even settles a in steady
state with Mdot ~ 5x10^{-5} Msun/s, which resembles the "plateau" phase in the
X-ray light curve. While the duration of the "prompt" phase depends on the
resolution in our simulations, we provide an analytical model taking into
account neutrino losses that estimates the duration to be ~20 s. The model
suggests that the steep decline in GRB X-ray light curves is triggered by the
circularization of the infalling stellar envelope at radii where the virial
temperature is below ~10^{10} K, such that neutrino cooling shuts off and an
outward expansion of the accretion shock becomes imminent.
