#example 1
#weight of a person
m=1 #kg
g=9.75 #acc.due to gravity in m/s^2
F=m*g #weight of 1 kg mass in N
print"\n hence,weight of person is",round(F,2)," N"
#example 2
#weight of a person
m=1 #lbm
g=32 #acc.due to gravity in ft/s^2
F=m*g/32.174 #weight of 1 lbm mass in lbf
print"\n hence,weight of person is",round(F,4)," lbf"
#example 3
#average volume and density
Vliq=0.2 #volume of liquid in m^3
dliq=997 #density of liquid in kg/m^3
Vstone=0.12 #volume of stone in m^3
Vsand=0.15 #volume of sand in m^3
Vair=0.53 #vo;ume of air in m^3
mliq=Vliq*dliq #mass of liquid in kg
dstone=2750 #density of stone in kg/m^3
dsand=1500 #density of sand in kg/m^3
mstone=Vstone*dstone #volume of stone in m^3
msand=Vsand*dsand #volume of sand in m^3
Vtot=1 #total volume in m^3
dair=1.1 #density of air in kg/m^3
mair=Vair*dair #mass of air
mtot=mair+msand+mliq+mstone #total mass in kg
v=Vtot/mtot #specific volume in m^3/kg
d=1/v #overall density in kg/m^3
print"\n hence,average specific volume is",round(v,6),"m^3/kg"
print"\n and overall density is", round(d),"kg/m^3"
#example 4
#calculating the required force
import math
Dcyl=0.1 #cylinder diameter in m
Drod=0.01 #rod diameter in m
Acyl=math.pi*Dcyl**2/4 #cross sectional area of cylinder in m^2
Arod=math.pi*Drod**2/4 #cross sectional area of rod in m^2
Pcyl=250000 #inside hydaulic pressure in Pa
Po=101000 #outside atmospheric pressure in kPa
g=9.81 #acc. due to gravity in m/s^2
mp=25 #mass of (rod+piston) in kg
F=Pcyl*Acyl-Po*(Acyl-Arod)-mp*g #the force that rod can push within the upward direction in N
print"\n hence,the force that rod can push within the upward direction is",round(F,1)," N"
#example 5
#Calculating atmospheric pressure
dm=13534 #density of mercury in kg/m^3
H=0.750 #height difference between two columns in metres
g=9.80665 #acc. due to gravity in m/s^2
Patm=dm*H*g/1000 #atmospheric pressure in kPa
print"\n hence, atmospheric pressure is",round(Patm,2),"kPa"
#example 6
#pressure inside vessel
dm=13590 #density of mercury in kg/m^3
H=0.24 #height difference between two columns in metres
g=9.80665 #acc. due to gravity in m/s^2
dP=dm*H*g #pressure difference in Pa
Patm=13590*0.750*9.80665 #Atmospheric Pressure in Pa
Pvessel=dP+Patm #Absolute Pressure inside vessel in Pa
Pvessel=Pvessel/101325 #Absolute Pressure inside vessel in atm
print"\n hence, the absolute pressure inside vessel is",round(Pvessel,3),"atm"
#example 7
#pressure inside vessel
dm=848 #density of mercury in lbm/ft^3
H=9.5 #height difference between two columns in inches
g=32.174 #acc. due to gravity in ft/s^2
dP=dm*H*g #pressure difference in lbf/in^2
Patm=848*9.5*32.174/(1728*32.174) #Atmospheric Pressure in lbf/in^2
Pvessel=dP+Patm #Absolute Pressure inside vessel in lbf/in^2
Pvessel=848*29.5*32.174/(1728*32.174)+Patm #Absolute Pressure inside vessel in lbf/in^2
print"\n hence, the absolute pressure inside vessel is",round(Pvessel,2),"lbf/in^2"
#example 8
#calculating pressure
dg=750 #density of gaasoline in kg/m^3
dR=1206 #density of R-134a in kg/m^3
H=7.5 #height of storage tank in metres
g=9.807 #acc. due to gravity in m/s^2
dP1=dg*g*H/1000 #in kPa
Ptop1=101 #atmospheric pressure in kPa
P1=dP1+Ptop1
print"hence,pressure at the bottom of storage tank if fluid is gasoline is",round(P1,1),"kPa"
dP2=dR*g*H/1000 #in kPa
Ptop2=1000 #top surface pressure in kPa
P2=dP2+Ptop2
print"\n hence, pressure at the bottom of storage tank if liquid is R-134a is",round(P2),"kPa"
#example 9
#calculating balancing force
Po=100#Outside atmospheric pressure in kPa
F1=25 #net force on the smallest piston in kN
A1=0.01 #cross sectional area of lower piston in m^2
P1=Po+F1/A1 #fluid pressure in kPa
d=900 #density of fluid in kg/m^3
g=9.81 #acc. due to gravity in m/s^2
H=6 #height of second piston in comparison to first one in m
P2=P1-d*g*H/1000 #pressure at higher elevation on piston 2 in kPa
A2=0.05 #cross sectional area of higher piston in m^3
F2=(P2-Po)*A2 #balancing force on second piston in kN
print"\n hence, balancing force on second larger piston is",round(F2,1),"N"