  We report on the development of Mezcal-SRHD, a new adaptive mesh refinement,
special relativistic hydrodynamics (SRHD) code, developed with the aim of
studying the highly relativistic flows in Gamma-Ray Burst sources. The SRHD
equations are solved using finite volume conservative solvers. The correct
implementation of the algorithms is verified by one-dimensional (1D) shock tube
and multidimensional tests. The code is then applied to study the propagation
of 1D spherical impulsive blast waves expanding in a stratified medium with
$\rho \propto r^{-k}$, bridging between the relativistic and Newtonian phases,
as well as to a two-dimensional (2D) cylindrically symmetric impulsive jet
propagating in a constant density medium. It is shown that the deceleration to
non-relativistic speeds in one-dimension occurs on scales significantly larger
than the Sedov length. This transition is further delayed with respect to the
Sedov length as the degree of stratification of the ambient medium is
increased. This result, together with the scaling of position, Lorentz factor
and the shock velocity as a function of time and shock radius, is explained
here using a simple analytical model based on energy conservation. The method
used for calculating the afterglow radiation by post-processing the results of
the simulations is described in detail. The light curves computed using the
results of 1D numerical simulations during the relativistic stage correctly
reproduce those calculated assuming the self-similar Blandford-McKee solution
for the evolution of the flow. The jet dynamics from our 2D simulations and the
resulting afterglow lightcurves, including the jet break, are in good agreement
with those presented in previous works. Finally, we show how the details of the
dynamics critically depend on properly resolving the structure of the
relativistic flow.
