Introduction: Python - Calculate Reynolds Number (Flow in a Tube)

About: Occupation: tech support

print ("Calculating Reynolds number (for a flow in a tube) ")
# ReynoldsNumber: ((DensityOfFluid * MeanVelocityOfFluid * HydraulicDiameterOfPipe)/DynamicViscosityOfFluid)

EnteredDensityOfFluid = input ("Enter the Density of Fluid: ")
EnteredMeanVelocityOfFluid = input ("Enter the Mean Velocity of Fluid: ")
EnteredHydraulicDiameterOfPipe = input ("Enter the Hydraulic Diameter of Pipe: ")
EnteredDynamicViscosityOfFluid = input ("Enter the Dynamic Viscosity of Fluid: ")

# Convert entered number to float
DensityOfFluid = float(EnteredDensityOfFluid)
MeanVelocityOfFluid = float(EnteredMeanVelocityOfFluid)
HydraulicDiameterOfPipe = float(EnteredHydraulicDiameterOfPipe)
DynamicViscosityOfFluid = float(EnteredDynamicViscosityOfFluid)

ReynoldsNumber = ((DensityOfFluid * MeanVelocityOfFluid * HydraulicDiameterOfPipe)/DynamicViscosityOfFluid)

print ("The Reynolds number is: ", ReynoldsNumber)
print ("For Reynolds number below about 2000, flow is laminar.")
print ("Above about 3000, flow is turbulent.")
print ("For values of Reynolds number between about 2000 and 3000, flow is unstable")

print ("Thank you to fxsolver.com for assistance with this equation.")