Dynamics of bubble growth and detachment from rigid and flexible orifices