  We present a model for the hydrodynamics of a relativistic jet interacting
with the circum-stellar medium (CSM). The shocked CSM and the jet material are
assumed to be in an infinitely thin surface, so the original 2D problem is
effectively reduced to 1D. From general conservation laws, we derive the
equation of motion for each fluid element along this surface, taking into
account the deceleration along the surface normal due to newly swept-up mass
and lateral expansion due to pressure gradient in the tangential direction. The
pressure and energy density of the shocked CSM are given by the jump conditions
at the forward shock. The method is implemented with a finite-differencing
numerical scheme, along with calculation of synchrotron emission and absorption
from shock-accelerated electrons, in a new code $\mathtt{Jedi}$ (for "jet
dynamics"). We present a number of test cases, including top-hat jet, power-law
structured jet, "boosted fireball" profile, and CSM with density jump at the
wind termination shock. Based on the agreement with other analytical and
numerical calculations, we conclude that our simplified method provides a good
approximation for the hydrodynamics and afterglow emission for a wide variety
of jet structures and CSM density profiles. Efficient modeling of the afterglow
from e.g., neutron star mergers, will provide important information on the jet
energetics, CSM properties, and the viewing angle.
