from __future__ import division
#variable initialisation
h1=10 #column water in cm
h2=5 #column of oil in cm
rd=0.75 #relative density of oil
h3=2 #column of mercury in cm
#solution
ga=9790 #density in N/m^3
a=h1/100
p=ga*a #pressure
print "(i)For water Column,p=",int(p),"N/m^2"
ga_o=rd*ga
p_o=(ga_o*h2)/100 #pressure
print "(ii)For Oil Column, p=",round(p_o,2),"N/m^2"
ga_m=13.6*ga
p_m=ga_m*h3/100 #pressure
print "(iii)for Mercury Column,p=",round(p_m,1),"N/m^2"
from __future__ import division
import math
#variable initialisation
d=5 #depth in m
rd=0.85 #relative density of liquid
br=0.750 #barometer reading of mercury in m
#solution
ga=rd*9790 #calculating gamma
p=int(br*13.6*9790) #Atmospheric Pressure
print "atmospheric pressure=",p ,"N/m^2"
ap=round(((d*ga)+p),0)
print "absolute pressure in the liquid at 5.0 m depth=",ap/1000,"kPa"
import math
#variable initialisation
p1=0 #pressure
rho=0.88 #density
ga_w=9790 #relative density in N/m^3
h=4 #height of water in m
h1=2 #height of water in m
#Calculation
ga_0=rho*9790
p2=p1+(ga_0*h1) #pressure at the oil-water interface
p3=round(p2+(ga_w*h),1) #pressure due to 4m of water
print "P3=",round(p3/1000,4),"kPa"
#variable initialisation
k=1.4 #assumed value
g=9.81 #gravity
rho=1.1120 #relative density in kg/m^3
h1=3500 #elevation above sea level in m
h2=1000 #elevation sea level in m
p1=89890 #pressue in Pa
#Calculation
#For an adiabatic process,
a=k/(k-1)
p2=int(((1-(((k-1)/k)*(((g*rho)*(h1-h2))/p1)))**a)*p1)
rho2=((p2/p1)**(1/k))*rho
print "Answer given in the book is wrong in decimal.It should be,"
print "rho2=",round(rho2,5),"kg/m^3"
#variable initialisation
RD_oil=0.70 #relative density of oil in kg/m^3
RD_mercury=13.6 #relative density of mercury in kg/m^3
RD_oil2=0.8 #relative density of oil 2 in kg/m^3
W=9790 #unit weight of water in N/m^3
D1=10 #diameter 1 in cm
D2=13 #diameter 2 in cm
D3=8 #diameter 3 in cm
#Calculation
D1=D1/100 #converting into m
D2=D2/100
D3=D3/100
#Equating the pressures on both the limbs at the horizontal plane.
#P_A+(D1+D2+D3)*ga_A=P_B+(D2*ga_B)+(D3*ga_m)
ga_A=RD_oil*W
ga_B=RD_oil2*W
ga_m=RD_mercury*W
#P_A-P_B is taken as PD
PD=((D2*ga_B)+(D3*ga_m)-(D1+D2+D3)*ga_A)/1000
print "P_A-P_B=",round(PD,3),"kPa"
#variable initialisation
ga_w=9790 #unit weight of water in N/m^3
ga_oil=0.83 #unit weight of oil in N/m^3
D1=3.5 #diameter 1 in cm
D2=6 #diameter 1 in cm
D3=12 #diameter 1 in cm
#Calculation
D1=D1/100 #converting into m
D2=D2/100
D3=D3/100
ga_oil=ga_oil*9790 #unit weight
#P_A+(D1+D2+D3)*ga_A=P_B+(D2*ga_B)+(D3*ga_m)
PD=((ga_w*(D1+D2))-(ga_w*(D2+D3))-(ga_oil*D1))/1000
print "Pressure at N is larger thean at M by",-round(PD,3),"kPa"
#variable initialisation
p1=20 #pressure in inner tank in kPa
p2=35 #pressure in outer tank in kPa
N=750 #barometer reading in mm
#Calculation
#Bourdon guage records guage pressure relative to the pressure of medium
#local pressure is measured by aneroid barometer
pN_abs=N+((p2*1000)/(13.6*9.79))
print "pN_abs=",round(pN_abs,1),"mm of mercury (abs)"
pM_abs=pN_abs+((p1*1000)/(13.6*9.79))
print "pN_abs=",round(pM_abs,1),"mm of mercury (abs)"
#variable initialisation
RD_oil=0.75 #relative density of oil in kg/m^3
RD_mercury=13.6 #relative density of oil in kg/m^3
D1=10 #Diameter 1 in cm
D2=150 #Diameter 2 in cm
D3=200 #Diameter 3 in cm
#calculation
D1=D1/100 #Converting into m
D2=D2/100
D3=D3/100
#Considering the pressure at the horizontal plane,
ga_o=RD_oil*9790 #specific weight of oil in N/m^3
ga_w=9790 #specific weight of water in N/m^3
ga_m=RD_mercury*9790 #specific weight of mercury in N/m^3
P_A=(D1*ga_m)-(D3-D2)*ga_w-D2*ga_o-D1*ga_w
print "P_A=",round(P_A/1000,3),"kPa"
#variable initialisation
RD_oil=0.8 #relative density of oil in kg/m^3
RD_mercury=13.6 #relative density of mercury in kg/m^3
D1=20 #Diameter in cm
D2=16 #Diameter in cm
D3=12 #Diameter in cm
D4=15 #Diameter in cm
#Calculation
D1=D1/100 #Converting into m
D2=D2/100
D3=D3/100
D4=D4/100
ga_o=RD_oil*9790 #specific weight of oil in N/m^3
ga_m=RD_mercury*9790 #specific weight of water in N/m^3
e=-(ga_o*(D1+D2))+((ga_o*(D4)))+(-((ga_o)*D3))+(ga_m*(D4+D3+(D1-D2)))
print "(P_M-P_N)=",round(e/1000,4),"kPa"
#variable initialisation
ga_o=0.9*9790 #relative density of oil in kg/m^3
P0=0 #pressure at top
d=0.6 #depth in m
s=1.5 #sides of tank in m
#Calculation
Pi=0.9*ga_o #pressure at the interface in N/m^2
Pb=Pi+9790*d #pressure on the bottom in N/m^2
F1=(1/2)*Pi*(0.9*s) #Force on the top of 0.l9 m of a side
F2=Pi*s*d #Force on the bottom of 0.6 m of a side
F3=(1/2)*(Pb-Pi)*d*s #remaining part of force on the bottom 0.6m of a side
F=F1+F2+F3 #Total force
print "Total force F=",round(F/1000,3),"kN"
Y_p=((F1*d)+(F2*(0.9+(d/2)))+(F3*(0.9+(2/3)*d)))/F #centre of pressure
print "Y_p=",round(Y_p,3),"m"
#variable initialisation
h=4.5 #height of board in m
#Calculation
#For critical stability,the centre of pressure must be at C
#h=height of C above B
Max=h/3
print "The maximum height=",Max,"m"
#variable initialisation
D=2.5 #diameter in m
rd=0.25 #relative density
p=1000 #pressure in kPA
f_a=120 #allowable stress in MPa
#solution
#Hoop stress in cylinder,sigma=(p*D)/(2*t)
#sigma=f_a=allowable stress
t=(p*D)/(2*f_a*1000)
print "A Thickness of",round(t*1000,2),"mm can therefore be used"
#variable initialisation
W_s1=10 #weight
W_s2=20 #weight
S1=0.8 #relative density
S2=1.2 #relative density
ga=9.79E+3 #gamma
#solution
V=(W_s2-W_s1)/(ga*(S2-S1))
print "volume=",round((V*1000),4),"L"
W_s1=20
W_s=W_s1+(ga*S1*V)
print "Weight in air=",int(W_s),"N"
import math
#variable initialisation
W=0.2 #weight in N
D=5 #diameter in mm
#solution
#(i)distance between marking of RD of 1.0 and 0.95
h1=(W/(9790*((math.pi/4)*(D*D)/(1000*1000))))*((1/0.95)-1)
print "h1=",round(h1*1000,2),"mm"
#(ii)distance between marking of RD of 1.0 and 1.05
h2=(W/(9790*((math.pi/4)*(D*D)/(1000*1000))))*((1/1.05)-1)
print "h2=",round(h2*1000,2),"mm"
print "h2 will be below the marking corresponding to relative density of 1.0"
#variable initialisation
az=2.5 #acceleration in m/s^2
g=9.81 #gravity
ga=9.79 #density
d=1.5 #depth in m
#calculation
#(a)When the acceleration is upwards
h=d*(d/2)
F_H=ga*h*(1+az/g) #Pressure force on a side wall per metre width
print "F_H=",round(F_H,2),"kN"
#(b)When the acceleration is downwards
az=-2.5 #acceleration in m/s^2
h=d*(d/2)
F_H=ga*h*(1+az/g) #Pressure force on a side wall per metre width
print "F_H=",round(F_H,3),"kN"