The critical velocity in swimming