import math
Constants
g = 9.81 # Gravitational acceleration (m/s²)
Input parameters
flow_rate = float(input("Enter flow rate (m³/s): ")) # Q (m³/s)
head = float(input("Enter total head (m): ")) # H (m)
density = float(input("Enter fluid density (kg/m³): ")) # ρ (kg/m³)
efficiency = float(input("Enter pump efficiency (as a decimal): ")) # η (e.g., 0.85)
speed = float(input("Enter pump speed (rpm): ")) # N (rpm)
Impeller diameter estimation
k = 1.2 # Empirical coefficient for initial diameter estimation
impeller_diameter = k * math.sqrt(head / flow_rate) # D (m)
impeller_diameter_mm = impeller_diameter * 1000 # Convert to mm
Specific speed (Ns)
specific_speed = (speed * math.sqrt(flow_rate)) / (head ** 0.75)
Power calculations
hydraulic_power = density * g * flow_rate * head # Pi (W)
brake_power = hydraulic_power / efficiency # P_input (W)
brake_power_hp = brake_power / 746 # Convert to horsepower (HP)
Cavitation check (NPSH)
npsh_available = float(input("Enter available NPSH (m): ")) # NPSHa (m)
vapor_pressure = float(input("Enter vapor pressure of fluid (Pa): ")) # Pv (Pa)
atmospheric_pressure = float(input("Enter atmospheric pressure (Pa): ")) # Patm (Pa)
suction_head = float(input("Enter suction head (m): ")) # hs (m)
friction_loss = float(input("Enter friction loss in suction pipe (m): ")) # hf (m)
npsh_calc = (atmospheric_pressure - vapor_pressure) / (density * g) + suction_head - friction_loss
Output results
print("\n--- Centrifugal Pump Design Results ---")
print(f"Impeller Diameter: {impeller_diameter_mm:.2f} mm")
print(f"Specific Speed (Ns): {specific_speed:.2f}")
print(f"Hydraulic Power: {hydraulic_power:.2f} W")
print(f"Brake Power: {brake_power:.2f} W ({brake_power_hp:.2f} HP)")
if npsh_available > npsh_calc:
print("Cavitation check passed (NPSHa > NPSHr).")
else:
print("Warning: Cavitation risk (NPSHa <= NPSHr).")
print("---------------------------------------")