# Density of air
#Given
Mw = 29.0 # Molecular weight of air
R = 8323/Mw # Universal gas constant
T = 273 + 20 # temperature in K
p = 50*144*47.88 # Pressure in N/m**2
# Solution
rho = p/(R*T) # from the state law
print "Desnity of air at 20 deg C and 50 psia = ",round(rho,2),"kg/m**3"
# Reduction in volume
# Given
dP = 10**6 # Pressure drop in N/m**2
V = 1 # Volume in m**3
bta = 2.2*10**9 # Bulk modulus of elasticity in N/m**2
# Solution
dV = -dP*V/bta # Change in volume in m**3
v = -dV*100
print "Reduction in volume = ",round(v,3),"%"
# Volume reduction
# Given
bta1 = 2.28*10**9 # Bulk modulus of elasticity at 20 deg C and 103.4 N/m**2
bta2 = 2.94*10**9 # Bulk modulus of elasticity at 20 deg C and 1034 N/m**2
p1 = 103.4 # Pressure in N/m**2
p2 = 1034 # Pressure in N/m**2
# Solution
bavg = (bta1+bta2)/2 # bulk modulus average in N/m**2
dP = p2-p1 # pressure drop in N/m**2
V = 10 # Volume in m**3
dV = dP*V/bavg # Change in volume in m**3
v = -dV
print "Volume reduction = ",round(v,8),"m**3"
print "Negative sign indicates the volume has reduced"
# Volume reduction
# Given
patm = 14.6 # Atmospheric pressure in psia
p1 = 100 # gauge pressure at point 1 in psia
p2 = 102 # gauge pressure at point 2 in psia
V = 1 # volume in m**3
# solution
p = p1+patm # absolute pressure in psia
b = p # for isothermal air
p1 = p2+patm # absolute pressure in psia
b1 = p1 # for isothermal air
dP = p1 - p # change in pressure
bavg = (b1+b)/2 # average bulk modulus of elasticity in N/m**2
dV = dP*V/bavg
v = -dV
print "An increase in pressure by 2 psia will result in a volume reduction of",round(v,4),"ft**3"
# Sonic velocity of air
from math import *
# Given
k = 1.4 # gas constant
R = 1716 # Universal gas constant in ft.lb/slug^oR
T = 68+460 # temperature in *oR
# solution
c = sqrt(k*R*T)
print "Sonic velocity in air at 68 deg F = ",round(c,0),"ft/s"
# Force required to move the piston
from math import *
# Given
d = 0.05 # diameter of cylinder 1 in m
l = 0.2 # length of the cylinder in meters
d1 = 0.052 # diameter of cylinder in m
mu = 0.09 # Viscosity of oil in Ns/m**2
U = 1 # velocity in m/s
Y = (d1-d)/2 # clearance between the two cylinders in m
A = pi*l*d # area in m**2
# Solution
tau = mu*U/Y # Shear stress in N/m**2
F = tau*A # Shear foce in N
print "Force required to move the piston by 1 m/s = ",round(F,2),"N"
# Distance between the walls; Shear Stress; Location of maximum velocity
from math import *
from sympy import *
# Given
mu = 1.005*10**-3 # Viscosity of water in Ns/m**2
# Solution
# Part a
# Velocity is given by the formula u = 10*(0.01*y-y**2)
# two boundary conditions must be satisfied
# at y=0;u=0 at the bottom of the plate
# at y=Y ; u = 0 at top of the plate
Y = 0.01 # Distance between the walls
Y1 = Y*100
print " (a) Distance between the walls = ",round(Y1,1),"cm"
# Part b
# tau = mu*du/dy # Newtons law of viscosity
# differentiate u wrt y
y = Symbol('y')
u = 10*(0.01*y-y**2)
uprime = u.diff(y)
y = 0
U = uprime
#print U
# for y =0 at the bottom plate we get
U1 = 0.01 # from U
tau = mu*10*U1 # shear stress in N/m**2
print " (b) Shear stress = ",round(tau,9),"N/m**2"
# Part c
# Shaer stress at 20um from the wall
tau1 = mu*10*(0.01-2*20*10**-6) # using the equation of U and y = 20*10**-6 calc shear stress in N/m**2
print " (c) Shear Stress at 20 um from the plate = ",round(tau1,9),"N/m**2"
# Part D
# Distance at which shaer stress is zero can be found from the location of maximum velocity
# equating uprime = 0
y1 = 0.01/2 # shear stress location
print " (d) Location of maximum velocity = ",round(y1,3),"m"
print "Above calculation indicates that the zero shear stress and the maximum velocity occurs at the same location which is half way between the plate","\n","This also is in conformity with the fact that , in a flowing fluid, the velocity is maximum where shear stress is zero"
# Shaft torque for linear and non linear distribution of velocity
from math import *
# Given
d = 0.1 # diameter of shaft in m
l = 0.2 # length of the shaft in m
t = 0.00002 # thickness in m
N = 30 # RPM of shaft
U = pi*d*30/60 # velocity in m/s
r1 = d/2
r2 = r1 + t # radius of bearing in m
mu = 0.44 # Viscosity of SAE-30 oil in Ns/m**2
# Solution
# part a
F = 2*pi*r1*l*mu*U/t
T =F*r1
print " (a) For linear distribution of velocity , shaft torque = ",round(T,2),"m.N"
# part b
F1 = 2*pi*l*mu*U/log(r2/r1)
T1 =F1*r1
print " (b) For non-linear distribution of velocity , shaft torque = ",round(T1,2),"m.N"
# Watts of energy lost to overcome friction
from math import *
# Given
mu = 0.44 # viscosity of the oil in Ns/m**2
N = 300 # RPM of the shaft
t = 0.00025 # thickness of the film oil in m
r1 = 0.15 # radius in m
r2 = 0.1 # radius in m
T = pi**2*mu*N*(r1**4-r2**4)/(60*t)
P = T*2*pi*N/60
print "Watts of energy lost in overcoming friction at 300 RPM = ",round(P,0),"Watts"
# Excessive pressure inside droplet
# Given
d = 0.01 # diameter in m
sigma = 0.073 # surface tension in N/m
# Solution
dP = 4*sigma/d # pressure excessive
print "Excessive pressure inside the droplet = ",round(dP,2),"N"
# Height to which alcohol will rise
# Given
sigma = 0.022 # surface tension in N/m
gma = 9789 # specific weight
S = 0.79 # specific gravity
d = 0.002 # diameter in m
# Solution
h =4*sigma*1000/(gma*S*d) # capillary height in m
print "The alcohol will rise to a height of",round(h,1),"mm in the glass tube"