Dynamics of swirling flows in a diverging pipe