Chapter 2: Pressure and Head

Example 2.1, Page 30

In [1]:
from __future__ import division
import math

 #Initializing  the  variables
z1  =  0;                                                         #Taking  Ground  as  reference
z2  =  -30                                                        #Depth
rho  =  1025                                                      #Density
g  =  9.81                                                        #Acceleration  due  to  gravity

 #Calculation
pressureIncrease  =  -rho*g*(z2-z1);

print "Increase in Pressure (KN/m2):",round(pressureIncrease/1000,1)
Increase in Pressure (KN/m2): 301.7

Example 2.2, Page 34

In [2]:
from __future__ import division
import math



 #Initializing  the  variables
p1  =  22.4*10**3                                                    #Initial  Pressure
z1  =  11000                                                            #Initial  Height
z2  =  15000                                                            #final  Height
g  =  9.81                                                                #Acceleration  due  to  gravity
R  =  287;                                                                #Gas  Constant
T  =  273-56.6                                                        #Temperature  

 #Calculations
p2  =  p1*math.exp(-g*(z2-z1)/(R*T));
rho2=p2/(R*T);
  
print "Final Pressure (kN/m2):",round(p2/1000,2)
print "Final Density  (kg/m3):",round(rho2,3)
Final Pressure (kN/m2): 11.91
Final Density  (kg/m3): 0.192

Example 2.3, Page 37

In [5]:
from __future__ import division
import math


 #Initializing  the  variables
p1  =  101*10**3                                                      #Initial  Pressure
z1  =  0                                                              #Initial  Height
z2  =  1200                                                           #Final  Height
T1  =  15+273                                                         #Initial  Temperature
g  =  9.81                                                            #Acceleration  due  to  gravity
gamma  =  1.4                                                         #Heat  capacity  ratio
R  =  287                                                                  #Gas  Constant

 #Calculations
p2  =  p1*(1-g*(z2-z1)*(gamma-1)/(gamma*R*T1))**(gamma/(gamma-1));
dT_dZ  =  -(g/R)*((gamma-1)/gamma);
T2  =  T1  +  dT_dZ*(z2-z1);
rho2 = p2/(R*T2);

print "Final Pressure (kN/m2)            :",round(p2/1000,2)
print "Temprature     (in degree celcius):",round(T2-273,1)
print "Density        (kg/m^3)           :",round(rho2,3)
Final Pressure (kN/m2)            : 87.33
Temprature     (in degree celcius): 3.3
Density        (kg/m^3)           : 1.101

Example 2.4, Page 39

In [6]:
from __future__ import division
import math



 #Initializing  the  variables
p1  =  101*10**3                                                      #Initial  Pressure
z1  =  0                                                                    #Initial  Height
z2  =  7000                                                              #Final  Height
T1  =  15+273                                                          #Initial  Temperature
g  =  9.81                                                                #Acceleration  due  to  gravity
R  =  287                                                                  #Gas  Constant
dT  =  6.5/1000                                                      #Rate  of  Variation  of  Temperature

 #Calculations
p2  =  p1*(1-dT*(z2-z1)/T1)**(g/(R*dT));
T2  =  T1  -  dT*(z2-z1);
rho2  =  p2/(R*T2);


print "Final Pressure (kN/m^2) :",round(p2/1000,2)
print "Final Density  (kg/m^3 ):",round(rho2,3)
Final Pressure (kN/m^2) : 40.89
Final Density  (kg/m^3 ): 0.588

Example 2.5, Page 44

In [7]:
from __future__ import division
import math


 #Initializing  the  variables
p  =  350*10**3;                                         #Gauge  Pressure
pAtm  =  101.3*10**3;                                    #Atmospheric  Pressure    
rhoW  =  1000;                                           #Density  of  Water
sigma  =  13.6;                                          #Relative  Density  of  Mercury
g  =  9.81                                               #Acceleration  due  to  gravity

 #Calculations
def Head(rho):
    head  =  p/(rho*g);
    return head
rhoM  =  sigma*rhoW;
pAbs  =  p  +  pAtm;

print "\nPart(a)- Equivalent head of water (m) :",round(Head(rhoW),2)
print "\nPart(b)- Equivalent head of water (m) :",round(Head(rhoM),2)
print "\nAbsolute pressure (kN/m^2)            :",pAbs/1000
Part(a)- Equivalent head of water (m) : 35.68

Part(b)- Equivalent head of water (m) : 2.62

Absolute pressure (kN/m^2)            : 451.3

Example 2.6, Page 45

In [8]:
from __future__ import division
import math

   

 #Initializing  the  variables
rho  =  10**3;                                  #Density  of  water
h  =  2;                                        #Height
g  =  9.81;                                     #Acceleration  due  to  gravity

 #Calculations
p=rho*h*g;  

print "Gauge pressure (k/m2) :",p/1000
Gauge pressure (k/m2) : 19.62

Example 2.7, Page 46

In [3]:
from __future__ import division
import math



 #Initializing  the  variables
rho  =  0.8*10**3;                                                  #Density  of  fluid
rhoM  =  13.6*10**3;                                              #Density  of  manometer  liquid
g  =  9.81                                                                #Acceleration  due  to  gravity

 #Calculations
def fluidPressure(h1,h2):
    P  =  rhoM*g*h2-rho*g*h1;
    return P

p1=fluidPressure(0.5,0.9)/1000
p2=fluidPressure(0.1,-0.2)/1000

print "!-----Part (a)-----! \nGauge pressure (kN/m2) :",round(p1,2)
print "\n!-----Part (b)-----! \nGauge pressure (kN/m2) :",round(p2,2)
!-----Part (a)-----! 
Gauge pressure (kN/m2) : 116.15

!-----Part (b)-----! 
Gauge pressure (kN/m2) : -27.47

Example 2.8, Page 47

In [10]:
from __future__ import division
import math



 #Initializing  the  variables
rho  =  10**3;                                                          #Density  of  fluid
rhoM  =  13.6*10**3;                                              #Density  of  manometer  liquid
g  =  9.81;                                                              #Acceleration  due  to  gravity
H  =  0.3;                                                                #  Differnce  in  height  =  b-a  as  in  text
h  =  0.7;

 #Calculations
result  =  rho*g*H  +  h*g*(rhoM-rho);

print "Pressure difference (kN/m^2):", round(result/1000,3)
Pressure difference (kN/m^2): 89.467

Example 2.9, Page 50

In [11]:
from __future__ import division
import math



 #Initializing  the  variables
rho  =  10**3;                                                          #Density  of  fluid
rhoM  =  0.8*10**3;                                                #Density  of  manometer  liquid
g  =  9.81;                                                              #Acceleration  due  to  gravity
a  =  0.25;
b  =  0.15;
h  =  0.3;
 #Calculations
def PressureDiff(a,b,h,rho,rhoM):
    P  =  rho*g*(b-a)  +  h*g*(rho-rhoM);
    return P
print "The presure difference,if the top of the manometer is filled with"
print "(a) air                          :",PressureDiff(a,b,h,rho,0)/1000, " N/m^2"
print "(b) oil of relative density 0.8. :",PressureDiff(a,b,h,rho,rhoM), "N/m^2"
The presure difference,if the top of the manometer is filled with
(a) air                          : 1.962  N/m^2
(b) oil of relative density 0.8. : -392.4 N/m^2

Example 2.10, Page 54

In [4]:
from __future__ import division
import math

 #Initializing  the  variables
phi  =  30;                                                              #30  degree
h  =  1.2  ;                                                              #  Height  of  tank
l  =  2;                                                                    #  Length  of  tank

 #Calculations
def SurfaceAngle(a,phi):
    g=9.81; # m/s**2    
    Theta  =  math.atan(-a*math.cos(math.radians(phi))/(g+a*math.sin(math.radians(phi))));  
    return Theta

 #case  (a)  a  =  4

print "ThetaA      (degree)      :",round(180 + 180/math.pi*SurfaceAngle(4,phi),2)

 #Case  (b)  a  =  -  4.5
tanThetaR  =  math.tan((SurfaceAngle(-4.5,phi)));

print "\nThetaR      (degree)      :",round(SurfaceAngle(-4.5,phi)*180/math.pi,2)

Depth  =  h  -  l*tanThetaR/2;
print "\nMaximum Depth of tank (m) :",round(Depth,4)
ThetaA      (degree)      : 163.65

ThetaR      (degree)      : 27.27

Maximum Depth of tank (m) : 0.6845