#Variable declaration
#(a) PV = 1 * RT, where
R=8314.0
P=60.0*10**6
T=320.0
Tc=191.0
Pc=4.64*10**6
#Calculation
V1=8314.0*T/P
#(b) In van der Waals equation (2.32), the constants may be taken as:
a=27*R**2*Tc**2.0/(64.0*Pc)
b=R*Tc/(8.0*Pc)
#Thus using equation 2.32:
import sympy
x=Symbol('x')
p=sympy.solve((60*10**6*x**2+a)*(x-0.0427)-(8314*320*x**2))
#(c) Tr=T/Tc ,Pr=P/Pc
Tr=T/Tc
Pr=P/Pc
#Thus from Figure 2.1,
Z=1.33
#V = ZnRT/P (from equation 2.31)
V3=Z*R*T/P
#Result
print"(a) Volume of vessel (ideal gas law) =",round(V1,4),"m**3"
print"(b) Volume of vessel(van der waals eq.) =",round(p[0],3),"m**3"
print"(c) Volume of vessel(generalised compressibility-factor chart) =",round(V3,4),"m**3"
#Variable declaration
#Mass rate of discharge of water, G = rho*u*A
rho=1000.0 #Density of Water
d=25.0*10**-3 #Diameter of nozzle
u=25.0 #Velocity of water at nozzle
#Calculation
import math
G=rho*u*math.pi/4*d**2
#Momentum of fluid per second = Gu
F=G*25
#Result
print"\n Reaction force = Rate of change of momentum =",round(F),"N"
#Variable declaration
#Momentum per second of approaching liquid in Y-direction = rho*u**2*A
rho=1000.0 #Density of water
d=50.0*10**-3 #Diameter of pipe
u=5.0 #Velocity of water in pipe
#Calculation
import math
M=rho*u**2*math.pi/4*d**2
Rf=M*(math.cos(math.pi/4)+math.sin(math.pi/4))
#Result
print"\n The resultant force in direction of arm of bracket =",round(Rf,1),"N"
#Variable declaration
#From equation 2.68:
# 0.5*((u2)**2-(u1)**2)=g*(z1-z2)+((P1-P2)/rho)
#Suffix 1 to denote conditions in the pipe and suffix 2 to denote conditions in the jet
#Symbols have their usual meaning
u1=0.0
z1=0.0
z2=0.0
P1=250.0*10**3
P2=0.0
rho=1000.0 #Density of water
g=9.81
#Calculation
import sympy
x=Symbol('x')
u2=solve((0.5*(x)**2)-((P1-P2)/rho))
print"Velocity of the jet, u2 =",round(u2[1],1),"m/s"
#Variable declaration
id=0.5 #internal diameter of pipe
rs=50 #revolution speed
ir=0.15 #internal radius of water
rho=1000 #density of water
#Calculation
omega=2*math.pi*rs
#The wall pressure is given by equation 2.82 as:
wall_pressure=rho*(omega)**2/2*((id/2)**2-ir**2)
#Result
print"\n The wall pressure is %.2e"%wall_pressure,"N/m**2"