sg=0.68 #specific gravity of gasoline
htg=17 #ft (height of gasoline)
htw=3 #ft (height of water)
#pressure p= (gamma*h)+atmp
#calculation
#pressure at water- gasoline interface p1 =sg*g*htg+atmp
p1=sg*62.4*htg #atmp=0 , p1 is in lb/ft**2
pr1=p1/144 #lb/in**2
#pressure head as feet of water H
H= p1/62.4 #ft
#similarly pressure p2 at tank bottom
p2=62.4*htw+p1 #lb/ft**2
pr2 = p2/144 #lb/in**2
#pressure head as ft of water H1
H1=p2/62.4 #ft
#Result
print "pressure at interface=",round(p1,1),"lb/ft**2"
print "pressure head at interface in feet of water =",round(H,1),"ft"
print "pressure at bottom=",round(p2,1),"lb/ft**2"
print "pressure head at bottom in feet of water =",round(H1,1),"ft"
%matplotlib inline
h=1250 #ft , height
T=59 #degree farenheit, Temprature
p=14.7 #psi (abs), pressure
sw=0.0765 #lb/ft**3, (specific weight of air at p)
#considering air to be compressible
#calculation
import math
#p1/p2=math. exp(-(g*(z1-z2))/(R*T))
ratp=math.exp(-(32.2*h)/(1716*(59+460)))
print "ratio of pressure at the top to that at the base considering air to be compressible=",round(ratp,3)
#considering air to be incompressible
#p2=p1-(sw*(z2-z1))
ratp1=1-((sw*h)/(p*144))
print "ratio of pressure at the top to that at the base considering air to be incompressible=",round(ratp1,3)
#Plot
z=[0,1250,5000]
p=[1,0.955,0.82]
a=plot(z,p)
z1=[0,1250,5000]
p1=[1,0.956,0.84]
a1=plot(z1,p1)
xlabel("(Z2-Z1)(ft)")
ylabel("(p2-p1)")
show(a)
show(a1)
#Given
T=10 #degree C, Temprature
dmax=40 #m, maximum diameter
p=598 #mm Hg, pressure
#Calculate
#pressure in lake at any depth h is given by p=gamma*h + local barometric pressure 'pbar'
#pbar/(gamma Hg)=598 mm= .598 m (gamma Hg) = 133kN/m**3
pbar=0.598*133 #kN/m**2
#(gamma water)=9.804 kN/m**3 at 10 dergree C
p=(9.804*40)+pbar #kN/m**2
#Result
print "The absolute pressure at a depth of 40 m in the lake=",round(p,0),"kPa(psi)"
sg1=0.90 #specific gravity of oil
sg2=13.6 #specific gravity of Hg
#height of column at different section
h1=36.0 #inches,
h2=6.0 #inches
h3=9.0 #inches
#Calculation
#pressure equation: airp+h1*sg1*(gamma water)+h2*sg1*(gamma water)-h3*sg2*(gamma water)=0
airp=-(sg1*62.4*((h1/12)+(h2/12)))+(sg2*62.4*(h3/12)) #lb/ft**2
#gage pressure = airp
pgage=airp/144
#Result
print "Gage pressure=",pgage,"psi"
gamma1=9.8 #kN/m**3, specific wt of gage
gamma2=15.6 #kN/m**3
h1=1 #m, height
h2=0.5 #m
#pA-(gamma1)*h1-h2*(gamma2)+(gamma1)*(h1+h2)=pB
#pA-pB=diffp
diffp=((gamma1)*h1+h2*(gamma2)-(gamma1)*(h1+h2))
#Result
print "The difference in pressures at A and B =",diffp,"kpa"
dia=4 #m, diameter
sw=9.8 #kN/m**3 specific weight of water
hc=10 #m, height
ang=60 #degrees, amgle
#Calculation
import math
A=math.pi*(dia**2)/4
fres=sw*hc*A
#for the coordinate system shown xc=xres=0
Ixc=math.pi*((dia/2)**4)/4
yc=hc/(math.sin (ang*math.pi/180))
yres= (Ixc/(yc*A))+yc
ydist=yres-yc
#Result
print "The resultant force acting on the gate of the reservoir =",round(fres*10**-3,2,),"kN"
print "The resultant force acts through a point along the diameter of the gate at a distance of ",round(ydist,2),"m"
y=[2,5,10,30]
hc=[0.44,0.18,0.0886,0.04]
a1=plot(y,hc)
xlabel("(hc) m")
ylabel("(Yr-Ym) m")
show(a1)
sw=64 #lb/ft**3 specific weight of water
h=10 #ft, depth
a=3 #ft, distance from horizontal axis
b=3 #ft distance from vertical axis
#Calculation
#shape is triangular, hence hc=h-(a/3)
hc=h-(a/3)
A=(0.5*a*b) #ft**3 area of the right angled triangle
fres=sw*hc*A #lb
Ixc=b*(a**3)/36
Ixyc=b*(a**2)*(b)/72
#according to the coordinate system taken yc=hc and xc=0
yres=(Ixc/(hc*A))+hc
xres=(Ixyc/(hc*A))
ydist=yres-hc
#Result
print "The resultant force on the area shown is=",round(fres,3),"lb"
print "yR=",round(yres,1),"ft"
print "xR=",round(xres,3),"ft"
sg=0.9 # specific gravity of oil
a=0.6 #m, length of square
pgage=50 #kPa, gage pressure
h1=2 #m; height 1
h2=2.6 #m height 2
#the force on the trapezoid is the sum of the force on the rectangle f1 and force on triangle f2
f1=((pgage*1000)+(sg*1000*9.81*h1))*(a**2) #N
f2=sg*1000*9.81*(h2-h1)*(a**2)/2 #N
fres=f1+f2 #N
#to find vertical location of fres fres*yres=(f1*(a/2))+(f2*(h1-h2))
yres=((f1*(a/2))+(f2*(a/3)))/fres #m
#Result
print "The resultant force on the plate is=",round((fres/1000),3),"kN"
print "The force acts at a distance of ",round(yres,3), "m " "\n above the bottom plate alond the vertical line of symmetry"
#Given
dia=6.0 #ft, diameter
l=1 #ft, length
#horizontal force f1=sw*hc*A
hc=dia/4 #ft
sw=62.4 #lb/ft**3, specific wt
A=(dia/2.0)*l #ft**2, area
f1=sw*hc*A #lb
#Calculation
#this force f1 acts at a height of radius/3 ft above the bottom
ht=(dia/2)/3 #ft
#weight w = sw*volume
import math
w=sw*((dia/2)**2)*math.pi/4*l #lb
#this force acts through centre of gravity which is 4*radius/(3*%pi) right of the centre of conduit
dist=(4*dia/2)/(3*math.pi) #ft
#horizontal force that tank exerts on fluid = f1
#vertical force that tank exerts on fluid = w
#resultant force fres =((f1)**2+(w)**2)**0.5
fres =((f1)**2+(w)**2)**0.5 #lb
#Result
print "The resultant force exerted by the tank on the fluid=",round(fres,1),"lb"
print "The force acts at a distance of",round(dist,3),"ft"
dia=1.5 #m
wt=8.5 #kN
#tension in cable T=bouyant force(Fb)-wt
#fluid is water
import math
sw=10.1 #kN/m**3
#Calculaton
vol=math.pi*dia**3/6 #m**3
Fb=sw*vol #kN
T=Fb-wt #kN
#Result
print "The tension in the cable =",round(T,2),"kN"
sg=0.65 #specific gravity of fuel
l1=0.75 #ft, horizontal distance
l2=0.5 #ft verticle distance
#0.5 ft =z1(max)
#0.5=0.75*(ay(max)/g)
aymax=(0.5*32.2)/0.75 #ft/s**2
#Result
print "The max acceleration that can occur before the fuel level drops \n below the transducer=",round(aymax,1),"ft/s**2"