Oaskar,
In pipe flow you only need two know of these three and then its its easy to calculate the third one.
Flow, head and diameter.
In this case i assume you have the head (pressure loss or you know what head your fan or compressor can develop).
The procedure is:
1) Calculate this constant a=ev/Q
e-pipe roughness
v-viscocity of the fluid (kinematic)
Q-is the flow rate
should be around 1.0*10^(-11) (order of magnitude)
2)calculate this constant B=[128*g*H*Q^3/(pi^3*L*v^5)]^0.5
g-gravitational constant 32.2 (or 9.81 if you are working SI)
H-head in ft
Q-flow rate
pi-3.142
L-length of duct
v-once again the viscocity of fluid (kinematic)
should get B~ 1.0*10^12 (order of magnitude)
3)now using the two constants you may calculate the Reynolds number using
Re^2.5=-2.0*log[pi*a*Re/14.8+(2.51*Re^1.5)/B]
there lots programs out to solve this equation ees, mathcad excel solver etc or a good calculator like HP 48g or a TI 92.
4) From the Reynolds number calculate the diameter directly using d=4*Q/(pi*v*Re)..
Hope this helps..
Yedwa