# Chapter 2 - Fluid Statics¶

## Example 1 - Pg 10¶

In [1]:
#calculate the final pressure and specific weight of the gas
#Initialization of variables
import math
gam=0.0765 #lb/ft^3
p=14.7 #psia
dz=10560. #ft
#calculations
pg=p*144./gam
p2=p*math.exp(-dz/pg)
gam2=p2/p*gam
#results
print '%s %.2f %s' %("Final pressure =",p2,"psia")
print '%s %.4f %s' %("\n Final specific weight =",gam2,"lb/ft^3")

Final pressure = 10.04 psia

Final specific weight = 0.0522 lb/ft^3


## Example 2 - Pg 12¶

In [2]:
#calculate the final pressure and specific weight
#Initialization of variables
import math
gam=0.0765 #lb/ft^3
p=14.7 #psia
dz=10560. #ft
n=1.235
#calculations
pg=p*144./gam
p2=p*math.pow((1- dz/pg *(n-1)/n),(n/(n-1)))
gam2=math.pow((p2/p),(1/n)) *gam
#results
print '%s %.2f %s' %("Final pressure =",p2,"psia")
print '%s %.4f %s' %("\n Final specific weight =",gam2,"lb/ft^3")

Final pressure = 9.89 psia

Final specific weight = 0.0555 lb/ft^3


## Example 3 - Pg 16¶

In [4]:
#calculate the absolute pressure
#Initialization of variables
pb=28.5 #in mercury
d=13.6 #g/cc
gam=62.4
pobs=-4. #psi
#calculations
patm=pb/12. *gam*d/144.
pabs=patm+pobs
P=pabs*144./gam
#results
print '%s %.1f %s' %("Absolute pressure =",pabs,"psia")
print '%s %.1f %s' %("\n Absolute pressure in feet of water =",P,"ft of water")

Absolute pressure = 10.0 psia

Absolute pressure in feet of water = 23.1 ft of water


## Example 4 - Pg 18¶

In [5]:
#calculate the pressure gauge at B and also the absolute pressure of air
#Initialization of variables
pb=28. #in mercury
d=13.6 #g/cc
gam=62.4
xm=15. #in
xw=10. #in
patm=28. #in
#calculations
pB=-xm/12 *gam/144 *d + xw*gam/144
pair=patm/12 *gam/144 *d - xm/12 *gam/144 *d
#results
print '%s %.2f %s' %("The pressure gauge at B indicates a reading of",-pB,"psi vacuum")
print '%s %.2f %s' %("\n Absolute pressure of Air =",pair,"psia")

The pressure gauge at B indicates a reading of 3.03 psi vacuum

Absolute pressure of Air = 6.38 psia


## Example 5 - Pg 20¶

In [6]:
#calculate the pressure difference and also compare the pressures at A and B
#Initialization of variables
pb=28.5 #in mercury
d=13.6 #g/cc
gam=62.4
xm=10. #in
xw=2. #ft
#calculations
dp= xw*gam/144 - xm/12 *gam/144 + xm/12 *gam/144 *d
#results
print '%s %.2f %s' %("Pressure difference =",dp,"psi")
if dp>0:
print '%s' %("\n Pressure at A is greater than that at B")
elif dp==0:
print '%s' %("\n Pressure at both A and B are equal")
else:
print '%s' %("\n Pressure at A is less than that at B")

Pressure difference = 5.42 psi

Pressure at A is greater than that at B


## Example 6 - Pg 24¶

In [1]:
#calculate the magnitude of total force, vertical and horiontal locations of the total force.
#Initialization of variables
import math
import scipy
from scipy import integrate
gam=62.4
x1=4. #ft
x2=6.  #ft
y1=6. #ft
z=8. #ft
dy=1. #ft
#calculations
A1=x1*x2
A2=1/2. *y1*y1
yc = (A1*(x1+x2+dy) + A2*(x1+x2))/(A1+A2)
hc=yc*math.sin(angle)
F=hc*gam*(A1+A2)
ic1=1/12. *x1*y1*y1*y1
ic2=1/36. *y1*x2*x2*x2
ydc=It/(yc*(A1+A2))
def momen(u):
m= gam*math.sin(angle) *(2*x1+u)*0.5*(x2-u)*(y1-u)
return m;

FEDC=gam*math.sin(angle) *A2*(x1+x2)
xed=MED/FEDC
xp= (A1*2*(x1+x2+dy) + (x1+x2)*(A2)*(x1+xed))/(A1*(x1+x2+dy) + A2*(x1+x2))
#results
print '%s %d %s' %("Magnitude of total force =",F,"lb")
print '%s %.3f %s' %("\n Vertical location of force =",ydc,"ft")
print '%s %.2f %s' %("\n Horizontal location of force =",xp,"ft from AB")
print '%s' %("\n Direction of force is perpendicular to the plane surface")
print '%s' %("The answers are a bit different from textbook due to rounding off error")

Magnitude of total force = 23993 lb

Vertical location of force = 0.266 ft

Horizontal location of force = 3.58 ft from AB

Direction of force is perpendicular to the plane surface
The answers are a bit different from textbook due to rounding off error


## Example 7 - Pg 27¶

In [2]:
#calculate the magnitude of force and the horizontal distance from line of action of Fv
#Initialization of variables
import math
gam=62.4
z=10. #ft
z2=5. #ft
z3=4.25 #ft
p=2. #psig
#calculations
h=p*144./gam
Av=z*z
Fh=gam*(z+h)*Av
hpc=1/12. *z*z*z*z /((h+z)*z*z)
Fv=gam*(z2+h) *z*z + gam*math.pi/4. *z*z *z
xp= (gam*(z2+h) *z*z *z2 + gam*math.pi/4. *z*z *z*z3)/(Fv)
F=math.sqrt(Fh*Fh + Fv*Fv)
#results
print '%s %d %s' %("Magnitude of force =",F,"lb")
print '%s %.2f %s' %("\n horizontal distance from line of action of Fv =",xp,"ft from AG")
print '%s' %("The answers are a bit different from textbook due to rounding off error")

Magnitude of force = 142127 lb

horizontal distance from line of action of Fv = 4.66 ft from AG
The answers are a bit different from textbook due to rounding off error


## Example 8 - Pg 33¶

In [9]:
#calculate whether the barge is stable and also find the location of the metacenter
#Initialization of variables
import math
gam=0.0765 #lb/ft^3
l=40. #ft
w=16. #ft
d=8. #ft
z=6.  #ft
BG=1. #ft
#calculations
I=1/12. *l*w*w*w
V=l*w*z
IVG=I/V - BG
MB=I/V
#results
print '%s %.2f %s' %("I/V -BG =",IVG,"ft ")
if IVG >0:
print '%s' %("\n Barge is stable")
else:
print '%s' %("\n The barge is unstable")

print '%s %.2f %s' %("\n Location of metacenter =",MB,"ft above the center of buoyancy ")

I/V -BG = 2.56 ft

Barge is stable

Location of metacenter = 3.56 ft above the center of buoyancy