The dynamics of a swirling flow in a pipe and transition to axisymmetric vortex breakdown