p1=30 #kPa
d=1000 #kg/(m**3)
r1=1 #m
r2=0.5 #m
#applying energy equation between points (1) and (2) and using the equation V**2=16*(r**2)
V1=(16*(r1**2))**0.5 #m/sec
V2=(16*(r2**2))**0.5 #m/sec
p2=((p1*1000)+(d*((V1**2)-(V2**2)))/2)/1000#kPa
#result
print "The pressure at point (2) =",round(p2,3),"kpa"
ang2=math.pi/6 #radians
#vp=-2*math.log(r)
#calculation
#vr=d(vp)/d'r
#vr=(-2)/r
#vang=(1/r)*(d(vp)/d(ang))
import math
from scipy import integrate
def f1(dtheta):
R=1
return((-2/R)*R)
q=integrate.quad(f1,0.0,(3.14/6))
#result
print "Volume rate of flow (per unit length) into the opening = ",round(q[0],2),"ft**2/s"
%matplotlib inline
h=200 #ft
U=40 #mi/hr
d=0.00238 #slugs/ft**3
#calculation
import math
#V**2= (U**2)*(1 + (2*b*math.cos(ang)/r) + ((b**2)/(r**2)))
#at point 2, ang=math.pi/2
#r=b*(math.pi-ang)/math.sin(ang)=(math.pi*b/2)
V=U*(1+(4/(math.pi**2)))**0.5 #mi/hr
y2=h/2 #ft
#bernoulli equation
#p1-p2= d*((V2**2)-(V1**2)) + (sw*(y2-y1))
V1=U*(5280/3600)
V2=V*(5280/3600)
pdiff=((d*((V2**2)-(V1**2))/2) + (d*32.2*(y2)))/144#psi
#result
print "elevation of point above the plane",round(y2,2),"ft"
print "The magnitude of velocity at (2) for a 40 mi/hr approaching wind =",round(V,1),"mi/hr"
print "The pressure difference between points (1) and (2)=",round(pdiff,2),"psi"
#Plot
import matplotlib.pyplot as plt
fig = plt.figure()
ax = fig.add_subplot(111)
u=[0,20,40,60,80,100]
p=[0.05,0.055,0.0647,0.08,0.10,0.12]
xlabel("U (mph)")
ylabel("p1-p2 (psi)")
plt.xlim((0,100))
plt.ylim((0,0.14))
ax.plot([40], [0.0647], 'o')
ax.annotate('(40mph,0.0647psi)', xy=(40,0.06))
a=plot(u,p)
show(a)
d=1.18*1000 #kg/m**3
vis=0.0045 #Ns/m**2, viscosity
Q=12.0 #ml/sec
dia1=4.0 #mm
l=1.0 #m
dia2=2.0 #mm
#calculation
import math
V=Q/(1000000*math.pi*((dia1/1000)**2)/4) #mean velocity, m/sec
Re=(d*V*dia1/1000)/vis
#result
print " The Reynolds number is ",round(Re,0),"is well below critical value of 2100 so flow is laminar."
pdiff=(8*vis*(l)*(12*10**-6)/(math.pi*(dia1/2000)**4))*10**-3 #kPa
print "a)The pressure drop along a 1 m length of the tube which is far from the tube entrance ",round(pdiff,),"kpa"
#for flow in the annulus
V1=Q/(1000000*math.pi*(((dia1/1000)**2)-((dia2/1000)**2))/4) #mean velocity, m/sec
Re1=d*((dia1-dia2)/1000)*V1/vis
#Result
print "b) The Reynolds number is ",round(Re1)," is well below critical value of 2100 so flow is laminar."
r1=dia1/2000
r2=dia2/2000
pdiff1=((8*vis*(l)*(12*10**-6)/(math.pi))*((r1**4)-(r2**4)-((((r1**2)-(r2**2))**2)/(math.log(r1/r2))))**(-1))*10**-3 #kPa
#result
print "The pressure drop along a 1 m length of the symmetric annulus =",round(pdiff1,1),"kpa"
#plot
import matplotlib.pyplot as plt
fig = plt.figure()
ax = fig.add_subplot(111)
T=[0,0.001,0.005,0.01,0.2,0.35,0.5]
K=[1.1,1.17,1.22,1.28,2.2,3.8,7.94]
xlabel("Ri/Ro")
ylabel("Pannulus/Ptube")
plt.xlim((0,0.5))
plt.ylim((1,8))
ax.plot([0.5], [7.94], 'o')
ax.annotate('(0.5,7.94)', xy=(0.5,7.9))
a=plot(T,K)
show(a)
T1=[0,0.001,0.005,0.01]
K1=[1.1,1.14,1.20,1.28]
xlabel("Ri/Ro")
ylabel("Pannulus/Ptube")
plt.xlim((0,0.01))
plt.ylim((1,1.3))
a1=plot(T1,K1)
show(a1)