Investigation of the dynamics of immiscible displacement of a ganglion in capillaries