There is no absolute formula, but there is a practical upper limit to speed for any given driver diameter. Historically, 536 rpm has been considered about the maximum that reciprocating motion in a steam engine can manage. Above that and valve gear and piston failure tend to happen. 536 rpm translates into 111.62 mph for a locomotive with 70" drivers. An N&W J, with 70" drivers has been reported to have slightly exceeded 110 mph on test on the PRR.
A British Pacific, Blue Peter, with 80" drivers, went into uncontrolled wheel slip and the valve gear disintegrated at what was calculated as a rotational speed of 135 mph, based on video footage. With 80" drivers, the practical upper limit would have been 127.5 mph, which is close to the 126 mph speed claimed by Mallard, another British Pacific also with 80" drivers.
The formula would be C X (pi) X D X60/5280 X 12. Where C is the rotational constant. I've used 536 in the examples above. D is the diameter of the driver in inches.
Model railroad magazines often quote a maximum speed as being 1.1 X driver diameter in inches, but this would limit a J to 77 mph, which they regularly exceeded by 25mph. In the drag freight era where drivers were small and heavily counterbalanced, that might apply, but with proper counterbalancing and modern lightweight rods, C=536 might be pushed up a tiny amount.
Michael Allen