Chapter 1: Introduction and Basic Concepts

Example 1-2, Page No.8

In [8]:
#Given values
p=850;# density in kg/m^3
V=2;  # volumne of tank in m^3

#Calculations
m=p*V;# mass, density and volumne corealtion

#Result
print 'The amount of oil in tank is %i kg' %round(m,0)
The amount of oil in tank is 1700 kg

Example 1-3, Page No.9

In [3]:
#Constants used
g=32.174;# gravitational constant in ft/s^2

#given values
m=1; # mass of 1.00 lbm is subjected to standard earth gravity

#Calculations
w=(m*g)/g; # weight is mass times the local value of gravitational acceleration
#dimensionally the above equation is represented as lbm * ft/s^2 * (lbf/ft/s^2)

#Result
print 'The weight on earth is %i lbf' %w
The weight on earth is 1 lbf

Example 1-4, Page No.21

In [4]:
# Example 1.4

# Given values
Tc=10; #change in temp in Celcius

# Calculations
Tk=Tc;
Tr=1.8*Tk;#conversion scale of temperature change from K to R
Tf=Tr;
# calculated using the corealtions b/w these scales

#Results
print 'the corresponding change is %i K' %Tk
print 'the corresponding change is %i R' %Tr
print 'the corresponding change is %i F' %Tf
the corresponding change is 10 K
the corresponding change is 18 R
the corresponding change is 18 F

Example 1-5, Page No.23

In [14]:
#Given values
Patm=14.5; #atmospheric pressure in psi
Pvac=5.8;  #vacuum gage reading in psi

#Calculations
Pabs=Patm-Pvac;#pressure in vaccumm is always treated to be negative

#Results
print'the absolute pressure in the chamber %f psi'%round(Pabs,1)
the absolute pressure in the chamber 8.700000 psi

Example 1-6, Page No.26

In [5]:
#Constants used
pw=1000; # density of water in kg/m^3;
g=9.81; # acceleration due to gravity in m/s^2;
 
#Given values
SG=0.85;# specific gravity of manometric fluid
h=0.55;# converting height from cm to m
Patm=96;# atmospheric pressure in kPa

# Calculations
p=SG*pw;
Ptank=Patm+(p*g*h/1000); # calculating pressure using liquid at same height have same pressure

#Results
print 'absolute pressure in tank %f kPa' %round(Ptank,1)
absolute pressure in tank 100.600000 kPa

Example 1-7, Page No.28

In [11]:
#Constants used
g=9.81;#acceleration due to gravity in m/s^2;

#Given values
h1=0.1;# distance b/w point 1 at air-water interface and point 2 at mercury-air interface in m
h2=0.2;# distance b/w oil-water interface and  mercury-oil interface in m
h3=0.35;# distance b/w air-mercury interface and  mercury-oil interface in m
pw=1000;# density of water in kg/m^3
pHg=13600;# density of mercury in kg/m^3
poil=800;# density of oil in kg/m^3
Patm=85.6;# atmospheric pressure in kPa

#Calculation
P1=Patm-(pw*g*h1+poil*g*h2-pHg*g*h3)/1000;#calculating pressure using liquid at same height have same pressure

#Results
print 'the air pressure in tank %i kPa' %round(P1)
the air pressure in tank 130 kPa

Example 1-8, Page No.31

In [12]:
#Constants used
g=9.81;# acceleration due to gravity in m/s^2;

#Given values
pHg=13570;# density of mercury at 10 C in kg/m^3
h=0.74;# converting barometric reading into m from mm

#Calculationa
Patm=pHg*g*h/1000;# standard  pressure formula

#Results
print 'the atmospheric pressure %f kPa' %round(Patm,1)
the atmospheric pressure 98.500000 kPa

Example 1-9, Page No.31

In [16]:
#constants used
g=9.81;#acceleration due to gravity in m/s^2;

#given values
m=60;# mass of piston in kg
Patm=0.97;# atmospheric pressure in kPa
A=0.04;# cross-sectional area in m^2

#calculation
P=Patm+(m*g/A)/100000;# standard  pressure formula
print 'The pressure inside the cylinder %f bar' %round(P,2)
#The volume change will have no effect on the free-body diagram drawn in part (a), and therefore the pressure inside the cylinder will remain the same
print('If some heat is transferred to the gas and its volume is doubled, there is no change in pressure');
The pressure inside the cylinder 1.120000 bar
If some heat is transferred to the gas and its volume is doubled, there is no change in pressure

Example 1-10, Page No.32

In [17]:
import math
from scipy.integrate import quad 
from pylab import *

#Constants used
g=9.81;#acceleration due to gravity in m/s^2;

#Given values
p=1040;# density on the water surface in kg/m^3
h1=0.8;# thickness of surface zone
H=4;# thickness of gradient zone
x0=0.0;# lower limit of integration
x1=4.0;# upper limit of integration


#Calculations
P1=p*g*h1/1000;#standard  pressure determination formula
#P2 = integration of the exp. p*g*(math.sqrt(1+(math.tan(math.pi*z/4/H)^2))) b/w 0-4
def intgrnd1(z): 
 return (p*g*(math.sqrt(1+(math.tan(math.pi*(z)/4/H)**2))) )#integrant
P2, err = quad(intgrnd1, x0, x1) 
P2=P2/1000;#converting into kPa
P=P1+P2;

#Results
print 'the gage pressure at the bottom of gradient zone %f kPa' %round(P)
the gage pressure at the bottom of gradient zone 54.000000 kPa