Chapter 04: Fluid Kinematics

Example 4.4-1, Page No:133

In [1]:
import math
%matplotlib inline

#Variable Decleration
#Defining u and v in comments
#u=0.5+0.8x
#v=1.5-0.8y
a=0.5 #Velocity component
b=0.8 #Velocity component
c=1.5 #Velocity component

#Calculations
#Part(a)
x=-a/b #x-component of stagnation point
y=c/b #y-component of stagnation point

#Result
print "There is a stagnation point at x=",round(x,3),"m","and y=",round(y,3),"m"

#Part (b)
import numpy as np
import matplotlib.pyplot as plt

Y, X = np.mgrid[-1:5:100j, -3:3:100j]
U = 0.5+0.8*X 
V = 1.5-0.8*Y
speed = np.sqrt(U*U + V*V)

plt.streamplot(X, Y, U, V, color=U, linewidth=1, cmap=plt.cm.autumn)
plt.colorbar()
plt.ylabel('y')
plt.xlabel('x')
plt.show()
There is a stagnation point at x= -0.625 m and y= 1.875 m

Example 4.4-2, Page No:136

In [2]:
import math

#Variable Decleration
V_dot=0.053*10**-3 #Vloumetric Flow rate in m^3/s
D_inlet=0.0107 #Diameter of the nozzle in m
D_outlet=0.0046 #Diameter of the nozzle at the outlet in m
delta_x=0.0991 #Length of the pipe in m

#Calcualtions
u_inlet=(4*V_dot)/(pi*D_inlet**2) #Velocity at the inlet in m/s
u_outlet=(4*V_dot)/(pi*D_outlet**2) #Velocity at the outlet in m/s
a_x=(u_outlet**2-u_inlet**2)/(2*delta_x) #Axial Acceleration in m/s^2

#Result
print "The magnitude of acceleration is",round(a_x,1),"m/s^2"
The magnitude of acceleration is 49.6 m/s^2

Example 4.4-3, Page No:138

In [1]:
import math
%matplotlib inline

#Variable Decleration
x=[-2,-1,0,1,2]
y=[-3,-2,-1,0,1,2,3]

#Calcualtions
a_x=0.4+0.64*x[4]
a_y=-1.2+0.64*y[6]

#Plotting
import numpy as np
import matplotlib.pyplot as plt

Y, X = np.mgrid[-1:5:100j, -3:3:100j]
U = 0.4+0.64*X
V = -1.2+0.64*Y
speed = np.sqrt(U*U + V*V)

plt.streamplot(X, Y, U, V, color=U, linewidth=1, cmap=plt.cm.autumn)
plt.colorbar()
plt.ylabel('y')
plt.xlabel('x')
plt.show()

#Result
print "The acceleration at x=2 and y=3 are a_x=",round(a_x,2),"m/s^2 and a_y=",round(a_y,3),"m/s^2"
The acceleration at x=2 and y=3 are a_x= 1.68 m/s^2 and a_y= 0.72 m/s^2