p=700 #pressure of fluid in kN/m**2
v1=0.28 #Initial volume of fluid in m**3
v2=1.68 #Final volume of fluid in m**3
#Calculations
W=p*(v2-v1) #Work done in kJ
#Output
print'The Work done is',round(W,1),'KJ or',round(W/1000,3),'MJ'
p1=138.0 #Initial pressure of gas in kN/m**2
p2=690.0 #Final pressure of gas in kN/m**2
v1=0.112 #Initial volume in m**3
#Calculations
P=p1/p2 #Pressure ratio
v2=v1*(P**(1/1.4)) #Final volume of gas in m**3
#Output
print'The new volume of the gas is',round(v2,3),"m**3"
p1=2070 #Initial pressure of gas in kN/m**2
p2=207 #Final pressure of gas in kN/m**2
v1=0.014 #Initial volume of gas in m**3
n=1.35 #constant
#Calculations
P=p1/p2 #Pressure ratio
v2=v1*(P**(1/1.35)) #Final volume of gas in m**3
W=(p1*v1-p2*v2)/(n-1) #Work done in kJ
#Output
print'(a)Final volume of gas ',round(v2,3),"m**3 "
print'(b)Work done by the gas during the expansion is',round(W,2),"kJ"
v1=0.056 #Initial volume of gas in m**3
v2=0.007 #Final volume of gas in m**3
p1=100 #Initial perssure compressed Isothermally in kN/m**2
#Calculations
p2=(p1*v1)/v2 #Final pressure in kN/m**2
W=p1*v1*(math.log(v2/v1)) #Work done in kJ
#Output
print'(a)Final pressure is',round(p2,0),"kN/m**2 "
print'(b)The work done on gas is',round(-W,2), "kJ"
v1=1.0 #Initial volume in m**3
v2=3.0 #Final volume in m**3
#Calculations
import math
W=10**5*(((v2**3-v1**3)/3)+8*(math.log(v2/v1))) #Work done in J
#Output
print'The work done is',round(W,0),"Nm"
v1=0.2 #Initial volume in m**3
v2=0.5 #Final volume in m**3
#Calculations
W=1500*(((v2**2-v1**2)/200)+(v2-v1))/1000 #Work done in kJ
#Output
print'The work done by the gas is',round(W,4),"KJ"
v1=1.5 #Initial volume in m**3
v2=2 #Final volume in m**3
w1=2 #Work receiving in Nm
p=6 #constsnt pressure of gas in N/m**2
#Calculations
w2=p*(v2-v1) #Work done in Nm
W=w2-w1 #Net work done by the system in Nm
#Output
print'Net work done by the system is',round(W,2),"Nm"
d=13596 #Density of Hg in kg/m**3
g=9.806 #gravity in m/sec**2
z=760.0 #Barometer pressure in mm of Hg
Pv=40.0 #Vaccum pressure in cm
dw=1000.0 #Density of water in kg/m**3
Zw=1.5 #Level of water in m
#Calculations
p=(d*g*z)/10**6 #Pressure in kPa
p1=(80/76.0)*p #Pressure in kPa
Pa=p-Pv #Absolute pressure in kPa
p2=(36/76.0)*p #Pressure in kPa
p3=(dw*g*Zw)/1000.0 #pressure in kPa
p4=(5.2*10**5)/1000.0 #pressure in kPa
#Output
print'(a)Pressure of 80cm of Hg is',round(p1,2),"kPa"
print'(b)Pressure of 40cm of Hg vaccum is',round(p2,2), "kPa "
print'(c)Pressure due to 1.5m of water coloumn is',round(p3*1000,4),"N/m**2or Pa"
print'(d)Pressure in kPa for 5.2bar is',round(p4,2),"kPa"
z=750 #Barometric pressure in mm of Hg
g=9.81 #Gravity in m/sec**2
Pa=101.325 #one atm pressure in kN/m**2
Pg=3.3 #Pressure in atm
Pf=3.2 #Pressure in m of water
d=13596 #Density of Hg in kg/m**3
#calculations
Pp=(d*g*z)/10**6 #Pressure in kPa
p1=(d*g*0.55)/1000.0 #Pressure in kPa
p2=Pp+(Pg*101.325) #Pressure in kPa
p3=Pp+(Pf*g*100)/1000.0 #Pressure in kPa
p4=4.6*100 #Pressure in kPa
#Output
print'(a)Pressure of 55cm of Hg (Abs)',round(p1,1),"KPa"
print'(b)Pressure at 3.3 atm (Gauge)',round(p2,1),"kPa"
print'(c)Pressure of 3.2m of water (Gauge)',round(p3,1),"kPa"
print'NOTE: In the book there is mistake in calculation p3 '
print'(d)Pressure of 4.6bar (Abs)',round(p4,1),"kPa"
Zw=50 #Manometer reading of water in cm
Zo=763 #Atmospheric pressure in mm of Hg
d=13.6*10**3 #Density of Hg in kg/m**3
dw=1000 #Density of water in kg/m**3
g=9.81 #Gravity in m/sec**2
#Calculations
Pa=(d*g*Zo)/10**6 #Atmospheric pressure in kPa
Pg=(dw*g*Zw)/10**5 #Gauge pressure in kPa
Pab=Pa+Pg #Absolute pressure in kPa
#Output
print'Absolute pressure is',round(Pab,2),"kPa"
Z=70 #Vaccum gauge reading in cm of Hg
Pa=101.325 #Atmospheric pressure in kPa
d=13.6*10**3 #Density of Hg in kg/m**3
g=9.81 #Gravity in m/sec**2
#Calculations
Pv=(d*g*Z)/10**5 #Vaccum pressure in kPa
Pab=Pa-Pv #Absolute pressure in kPa
#Output
print'Absolute pressure is',round(Pab,2),"kPa"
Pv=30 #Vaccum pressure in kPa
Z=755 #Barometer reading in mm of Hg
d=13590 #Density of Hg in kg/m**3
g=9.81 #Gravity in m/sec**2
#calculations
Pa=(d*g*Z)/10**6 #Atmospheric perssure in kPa
Pab=Pa-Pv #Absolute pressure in kPa
#Output
print'Asolute pressure in the tank is',round(Pab,2),"kPa"
Z=0.562 #Level of open limb in m
Z1=0.761 #Barometer reading in m of Hg
g=9.79 #Gravity in m/sec**2
d=13640 #Density of Hg in kg/m**2
#Calculations
Pa=(d*g*Z1)/1000.0 #Atmospheric pressure in kPa
Ph=(d*g*Z)/1000.0 #Pressure exercterd due to height in kPa
Pab=Pa+Ph #Absolute pressure in kPa
#Output
print'The gas pressure is',round(Pab,3),"kN/m**2"
d=13.596*10**3 #Density of Hg in kg/m**3
dl=800 #Density of liquid in kg/m**3
Z=30 #Level of the liquid in the arm in cm
Z1=0.75 #Barometric pressure in m
g=9.81 #Gravity in m/sec**2
#Calculatins
Pg=(dl*g*Z)/10**7 #Gauge pressure in bar
Pa=(d*g*Z1)/10**5 #Atmospheric pressure in bar
Pab=Pa+Pg #Absolute pressure in bar
#Output
print'Absolute pressure of the gas is',round(Pab,2),"bar"
print'NOTE:In the book there is calculation mistake in last step'
Z1=0.17 #Level of liquid in m
Z=0.76 #Barometer readings in m
d=13596 #Density of Hg in kg/m**3
g=9.806 #Gravity in m/sec**2
s=0.8 #Specific gravity
d1=1000 #Density of water in kg/m**3
#Calculations
dl=s*d1 #Density of given liquid in kg/m**3
Pa=d*g*Z #Atmospheric pressure in N/m**2
p=dl*g*Z1 #Pressure in N/m**2
Pab=(Pa-p)/10**5 #Absolute pressure in bar
#Output
print'Absolute pressure of the gas is',round(Pab),"bar"
g=9.806 #Gravity in m/sec**2
d=13596 #Density of Hg in kg/m**3
Z=9.75 #Level of Hg in cm
dw=1000 #Density of water in kg/m**3
Zw=0.034 #Coloumn of condensate in m
Zo=0.76 #Atmospheric pressure in m of Hg
#Calculations
P=dw*g*Zw #Pressure in N/m**2
Pa=d*g*Zo #Atmospheric pressure in N/m**2
Pg=(d*g*Z)/100.0 #Gauge pressure in N/m**2
Pab=(Pa+Pg-P)/10**5 #Absolute pressure in bar
#Output
print'Pressure due to height is',round(P,3),'N/m**2'
print'Atmospheric Pressure is ',round(Pa,0),'N/m**2'
print'Absolute pressure of steam is',round(Pab,4),"bar"
g=9.7 #Gravity in m/sec**2
d=13.69*10**3 #Density of Hg in kg/m**3
dw=1000 #Density of water in kg/m**3
Pa=98 #Atmospheric pressure in kPa
Z=0.6 #Manometer level difference in m of Hg
Zw=0.04 #Water coloumn level in m
#Calculations
Pw=(dw*g*Zw)/1000.0 #Pressure due to water in kPa
Pg=(d*g*Z)/1000.0 #Pressure in kPa
Pab1=Pa+Pg-Pw #Absolute pressure in kPa
Pab=Pab1/100.0 #Absolute pressure in bar
#Output
print'The absolute pressure of steam is',round(Pab,2),"bar"
Z=0.76 #Actual height of mercury coloumn in m
g=9.806 #Gravity in m/sec**2
d=13596 #Density of Hg in kg/m**3
dw=1000 #Density of water in kg/m**3
Zw=0.035 #Height of condensate coloumn in m
Zh=0.10 #Height of mercury coloumn in m
#Calculations
Pa=d*g*Z #Atmospheric pressure in N/m**2
Pw=dw*g*Zw #Pressure due to water in N/m**2
Ph=d*g*Zh #Pressure due to Hg in N/m**2
Pab=(Pa+Ph-Pw)/10**5 #Absolute pressure in bar
#Output
print'Absolute pressure of steam in the pipe is',round(Pab,2),"bar"
dk=800 #Density of kerosene in kg/m**3
g=9.81 #gravity in m/sec**2
Zk=0.051 #Kerosene vapour on Hg coloumn in m
d=13600 #Density of Hg in kg/m**3
Zh=0.1 #Hg level in m
Z=0.755 #Atmospheric pressure in m of Hg
#Calculations
Pk=dk*g*Zk #Pressure of kerosene in N/m**2
Pa=d*g*Z #Atmospheric pressure in N/m**2
Ph=d*g*Zh #Pressure due to Hg in N/m**2
Pab=(Pa+Ph-Pk)/1000.0 #Absolute pressure in kPa
#Output
print'Absolute pressure of vapour is ',round(Pab,2),"kPa"
d=13596 #Density of Hg in kg/m**3
g=9.806 #Gravity in m/sec**2
df=0.8*1000 #Density of fluid in kg/m**3
Z=0.76 #Atmospheric pressure in m of Hg
Zf=0.3 #Height of fluid coloumn in m
#Calculations
Pa=d*g*Z #Atmospheric perssure in N/m**2
P=df*g*Zf #Pressure due to fluid in N/m**2
Pab=(Pa+P)/10**5 #Absolute pressure in bar
Zh=((Pab*10**5-Pa)/(d*g))*100 #Difference between the height of Hg coloumn in 2 arms in m
#Output
print'(a)The Absolute pressure of the gas in pipe line Pab',round(Pab,2)," bar"
print'(b)If the fluid used is Hg then the difference of height of Hg coloumn in the 2 arms is',round(Zh,2),"cm"
Pa=1 #Atmospheric pressure in bar
g=9.81 #Gravity in m/sec**2
do=0.8*1000 #Density of oil in kg/m**3
Zo=0.8 #Level of oil in m
dw=1000 #Density of water in kg/m**3
Zw=0.65 #Level of water in m
d=13.6*10**3 #Density of Hg in kg/m**3
Z=0.45 #Level of Hg in m
#Calculations
Po=(do*g*Zo)/10**5 #Pressure of oil in bar
Pw=(dw*g*Zw)/10**5 #Pressure of water in bar
P=(d*g*Z)/10**5 #Pressure of Hg in bar
Pab=Pa+Po+Pw+P #Pressure at the bottom of the coloumn in bar
Pow=Pa+Po #Pressure at the interface of oil and water in bar
Poh=Pa+Po+Pw #Pressure at the interface of water and Hg
#Output
print'(a)Pressure at the bottom of the coloumn is',round(Pab,2),"bar"
print'(b)Pressure at the inter surface of oil and water ia',round(Pow,3),"bar "
print'(c)Pressure at the inter surface of water and Hg ',round(Poh,3),"bar"
Z=0.76 #Barometer reading in m
g=9.81 #Gravity in m/sec**2
d=13.6*10**3 #Density of Hg in kg/m**3
Pab=1.2*10**5 #Absolute pressure in N/m**2
do=0.8*1000 #Density of oil in kg/m**3
dw=1000 #Density of water in kg/m**3
dh=13.6*10**3 #Density of Hg in kg/m**3
#calculations
Pa=dh*g*Z #Atmospheric pressure in N/m**2
Pg=Pab-Pa #Gauge pressure in N/m**2
Zo=Pg/(do*g) #Height of oil in manometer in m
Pw=Pab-Pa #Pressure exercted by water in N/m**2
Zw=Pw/(dw*g) #Height of water in manometer in m
P=Pab-Pa #Pressure of Hg in N/m**2
Zh=P/(d*g) #Height of Hg in manometer in m
#Output
print'(a)The height of fluid for oil Manometer',round(Zo,2),"m "
print'(b)The height of fluid for water Manometer ia',round(Zw,2),"m"
print'(c)The height of fluid for Hg Manometer is',round(Zh,3),"m"
Zg=0.753 #Barometer reading at ground level in m
Zp=0.690 #Pilots barometer reading in the plane in m
d=13600 #Density of Hg in kg/m**3
g=9.81 #Gravity in m/sec**2
da=1.25 #Density of air in kg/m**3
#Calculations
Pg=d*g*Zg #Pressure at ground level in N/m**2
Pp=d*g*Zp #Pressure at plane level in N/m**2
P=Pg-Pp #Change of pressure at ground level and that of plane level in N/m**2
Za=P/(da*g) #Altitude of plane from ground in m
#Output
print'The altitude of the plane from ground level is',round(Za,1),"m"
dw=1000 #Density of water in kg/m**3
dh=13590 #Density of Hg in kg/m**3
Pa=400 #Pressure at A in kPa
g=9.81 #Gravity in N/m**2
Zw1=2.5 #First level of water in m
Zw2=0.4 #Second level of water in m
Zh=0.6 #Level of Hg in m
#Calculations
Pw1=dw*g*Zw1 #First level of water pressure in N/m**2
Pw2=dw*g*Zw2 #Second level of water pressure in n/m**2
Ph=dh*g*Zh #Pressure of Hg in N/m**2
Pb=((Pa*1000)+Pw1+Pw2-Ph)/1000 #Pressure exercted at B in kPa
#Output
print'Pressure exercted at B is',round(Pb,2),"KPa"
do=0.902*10**3 #Density of oil in kg/m**3
Pg=2*10**5 #Gauge pressure in N/m**2
g=9.81 #Gravity in m/sec**2
ho=2 #Level of oil in m
d=2 #Diameter of cylinder in m
pi=3.141595 #Constant value of pi
#Calculations
A=(pi/4.0)*d**2 #Area of cylinder
Po=do*g*ho # Pressure due to oil in N/m**2
W=(Pg+Po)*A #Weight of the piston in N
#Output
print'The total weight of piston and slab is',round(W,2),"N"
m=21 #Mass of piston in kg
P1=600 #Pressure in the pipe 1 in kPa
P2=170 #Pressure in the pipe 2 in kPa
d1=0.10 #Diameter of the piston 1 in m
d2=0.20 #Diameter of the piston 2 in m
pi=3.14155 #Constant value of pi
#Calculations
F=(m*9.81)/1000 #Force due to mass in kN
F1=(pi/4)*d1**2*P1 #Force 1 acting on 10 cm diameter piston in kN
F2=(pi/4)*(d2**2-d1**2)*P2 #Force 2 acting on 20 cm diameter piston in kN
F3=F+F1+F2 #Total downward force in kN
P3=F3/((pi/4)*d2**2) #Pressure 3 in the gas in kPa
#Output
print'The pressure in the gas is ',round(P3,2),"KPa"
P1=0.755 #Barometric reading at the bottom of the building in m
P2=0.73 #Barometric reading at the top of the building in m
da=1.18 #Density of air in kg/m**3
g=9.81 #Gravitalional constant in m/sec**2
d=13600 #Density of Hg in kg/m**3
#Calculations
h=((P1-P2)*d*g)/(da*g) #The height of the building in m
#Output
print'The height of the building ',round(h,1),"m"
PA=200 #Gauge pressure reading for A in kPa
PB=120 #Gauge pressure reading for B in kPa
hb=750 #Barometer reading in mm of Hg
g=9.806 #Gravitational constant in m/sec**2
d=13597 #Density of Hg in barometer in kg/m**3
#Calculations
Pa=d*g*hb/10**6 #Atmospheric pressure in kPa
Pab1=PA+Pa #Absolute pressure in container A in kPa
Pab2=PB+Pab1 #Absolute pressure in container B in kPa
#Output
print'(a)The absolute pressure in the container A is',round(Pab1,1),"kPa"
print'(b)The absolute pressure in the container B is ',round(Pab2,2),"kPa"
C1=40 #Temperature 1 in degree centigrade
C2=-20 #Temperature 2 in degree centigrade
#calculations
F1=((C1/100.0)*180)+32 #Temperature 1 in Fahrenheit
F2=((C2/100.0)*180)+32 #Temperature 2 in Fahrenheit
#Output
print'(a)Temperature after converting 40 degree C is',round(F1,2),"F"
print'(b)Temperature after convertibg -20 degree C is ',round(F2,2),"F"
C=(-32/180.0)/((1/100.0)-(1/180.0)) #Centrigade temperature in degree C
F=C #Fahrenheit temperature in degree Fahrenheit
print'The temperature which has the same value on both the centrigrade and fahrenheit scales is',C
P1=1.5 #Thermometric properties at ice point
P2=7.5 #Thermometric properties at steam point
P3=3.5 #Thermometric property
#Calculations
import math
M = array([[math.log(P2), 1], [math.log(P1), 1]])
N=([100,0])
X=inv(M)*N #Inverse matrix
a=X[0,0]
b=X[1,0]
t=(a*math.log(P3)+b) #Required temperature in degree C
#Output
print'The required temperature is ',round(t,2),"C"
T1=100
T2=300 #Temperature of ice and steam point in the scale
P1=1.86 #Values of thermometric properties at ice point nad steam point respectively
P2=6.8
P=2.5 #Thermometric property
#Calculations
import math
#aln(P2)+b=300 #Costants in the temprature scale reading, a and b
#aln(P1)+b=100
#Solving above two equations
a=(T2-T1)/(math.log(P2/P1))
b=T2-a*math.log(P2)
t=(a*math.log(P)+b) #Required temperature in degree C
#Output
print'Temperature corresponding to the thermometric property is ',round(t,1),"C"
p1=32.0 #Pressure in mm of Hg at triple point of water
p2=76.0 #Pressure in mm of Hg above atmospheric pressure
p3=752.0 #Barometric pressure in mm of Hg
T=273.16 #Triple point of water in K
#Calculations
P1=p3+p1 #Total pressure in mm of Hg
P2=p2+p3 #Total pressure in mm of Hg
T2=((T*P2)/P1)-273.16 #Temperture in degree C
#Output
print'Temperature is ',round(T2,2),"C"
T1=32 #Temperatures of ice point and steam point respectively
T2=212
P1=1.86 #P values at ice point and steam point respectively
P2=6.81
P=2.5 #Reading on the thermometer
#Calculations
import math
#aln(P1)+b=32 #Costants in the given temprature scale reading, a and b
#aln(P2)+b=212
#Solving above two equations
a=(T2-T1)/(math.log(P2/P1))
b=T2-a*math.log(P2)
t=(a*math.log(P)+b) #Required temperature in degree C
#Output
print'Temperature corresponding to the thermometric property is ',round(t,0),"C"