From what I have seen playing around with freeware to optimize port size for a given enclosure and tuning, it comes down to speed of air through a port. Too small and the port chuffs or makes other odd noises. Too large and the port length becomes unmanageable.
winisd is what I use to model enclosures. When you pick a port diameter, it calcs both port length, and a mach reading (speed). It color codes mach readings to help interpret the results.
What size box, and what tuning do you seek?