  The external forward shock emitting the gamma-ray burst (GRB) afterglow is
collisionless, and it is mediated by the Weibel instability which generates the
magnetic field. The GRB afterglow shows that the magnetic field in the large
downstream region is much stronger than the shock-compressed pre-shock field.
However, particle-in-cell (PIC) simulations of relativistic shocks propagating
into homogeneous media show that the Weibel generated field decays near the
shock front. Some GRB observations and theoretical studies suggest that the
preshock medium is inhomogeneous. We perform the PIC simulation of a
relativistic shock propagating into inhomogeneous plasma. It is found that the
post-shock magnetic field decays slowly compared with the homogeneous case.
Sound waves and entropy waves are also generated by the shock-wave interaction,
and temperature anisotropy is produced by the sound wave in the downstream
region. The free energy of the temperature anisotropy is large enough to
explain the observed field strength. Our results show that the upstream density
fluctuation has a significant effect in the downstream region of collisionless
shocks even if the wavelength of the upstream inhomogeneity is much larger than
the kinetic scale.
