#Calculate the time required for mixing
# variables
L=10**(-6) #m
D=1.2*10**(-9) #m**2/s
# calculation
t=2*L**2/D #s
# result
print "The time required for mixing is %f seconds"%t
#Calculate the power required to run an impeller
# variables
D_tank=3. #ft
D_impeller=D_tank/3 #ft
N=4. #rps
v=1.077*10**(-5) #ft**2/s
# calculation
R_impeller=N*D_impeller**2 #dimentionless (reynold's number)
#1 lbf.s**2 = 32.2 lbm.ft
#1 hp.s = 550 lbf.ft
rho_water=62.3 #lbm/ft**3
P=5*rho_water*N**3*D_impeller**5/32.2/550.0 #hp
# result
print "The power required to run an impeller is %.2f hp"%P
#Calculate the impeller speed in a model of a large mixer if the power per unit volume remains the same
# variables
#let D1/D2 be denoted by ratio_D
ratio_D=5. #dimentionless
N2=240. #rpm
# calculation
N1=N2/ratio_D**(2/3.) #rpm
# result
print "the impeller speed in a model of a large mixer if the power per unit volume remains the same is %d rpm"%N1
#Calculate the time required to blend two miscible, low viscosity liquids
# variables
D_tank=3. #ft
D_impeller=D_tank/3 #ft
H_tank=D_tank #ft
N=4.0 #rps
# calculation
t_blend=4.3*(D_tank/H_tank)*(D_tank/D_impeller)**2/N #s
# result
print "the time required to blend two miscible, low viscosity liquids is %.1f s"%t_blend
#Calculate how far is the concentration of 0.1% from initial interface and the volume mixed
# variables
c=0.1 #percent
c_interface=50. #percent
c_original=0. #percent
ratio_c=(c-c_interface)/(c_original-c_interface) #dimentionless
# calculations
#erf(0.998)=2.15
#time required forfluid to travel 700 miles at 8ft/s is 4.57*10**5 sec
t=4.57*10**5 #s
D=2*10**(-9) #m**2/s
x=2*2.15*(D*t)**0.5 #m
print "x=%.2f m"%x
v0=0.355 #ft**3 of liquid/ft of pipe
#1 m = 3.281 ft
V_mixed=2*(3.281*x)*v0 #ft**3
# result
print "The mixed volume is %.2f ft**3"%V_mixed
#Calculate how far is the concentration of 0.1% from initial interface and the volume mixed
# variables
v=8. #ft/s
f=0.0039 #dimentionless (fanning friction factor)
D_turbulent=0.665*v*3.57*(f)**0.5 #ft**2/s
# calculation
#time required forfluid to travel 700 miles at 8ft/s is 4.57*10**5 sec
t=4.57*10**5 #s
x=2*2.15*(D_turbulent*t)**0.5 #ft
print "x=%f m"%x
v0=0.355 #ft**3 of liquid/ft of pipe
V_mixed=2*x*v0 #ft**3
# result
print "The mixed volume is %f ft**3"%V_mixed
#Calculate how far downstream does the dye become uniformly distributed throughout the fluid
# variables
f=0.0039 #dimentionless (fanning friction factor)
D=0.665 #ft
# calculation
L=D*0.56/(f)**0.5 #ft
# result
print "L = %.0f ft"%L
#Calculate the width of jet and entrainment ratio
import math
# variables
Vo=40. #ft/s
Do=1. #ft
x=10. #ft
K=6.2 #dimentionless
# calculation
V_centerline=Vo*K*(Do/x) #ft/s
alpha=20. #degrees
Dx=Do*(1+(x/Do)*math.sin(alpha*math.pi/180.0)) #ft
#Let entrainment ratio be r
r=0.62*(x/Do)**0.5#dimentionless
# result
print "The jet diameter is %.2f ft\n"%Dx
print "The entrainment ratio is %.2f"%r
#Calculate the SO2 concentration at the centerline
import math
# variables
Q=20. #gm/s
u=3. #m/s
sigma_y=30.0 #m
sigma_z=20.0 #m
y=60. #m
z=20. #m
H=0. #m
# calculation
c=Q/(2.0*math.pi*u*sigma_y*sigma_z)*math.exp(-((y**2/2.0/sigma_y**2)+((z-H)**2/2.0/sigma_z**2)))#gm/m**3
# result
print "The SO2 concentration at the centerline is %f gm/m**3"%c