Gasdynamics of relativistically expanding gamma-ray burst sources : kinematics, energetics, magnetic fields, and efficiency