Flow Over Bicycle (Python)
AIM: To calculate the drag force against a cyclist.
GOVERNING EQUATIONS: `1/2 ρAv^2 c_d`
Where,
`ρ` is the Density of Air in `kg/m^3`
`A` is the Frontal area of the cyclist in `m^2`
`v` is the Velocity of the cyclist in `m/s`
`c_d` is the drag coefficient
OBJECTIVES:
- To calculate the drag force experienced by a cyclist.
- To plot the graph of Drag force as a function of Velocity.
- To plot the graph of Drag force as a function of Drag coefficient.
CODE SNIPPET:
# program to calculate the drag force
import matplotlib.pyplot as plt
# Velocity vs Drag Force
# Drag coefficient
c_d = 0.8;
# Frontal Area (m^2)
A = 0.1;
# Density (kg/m^3)
rho = 1.2;
# Bicycle velocity (m/s)
velocities = [2,4,5,7,8,10,12,15]
drag_force = []
for velocity in velocities:
drag_force.append(0.5*c_d*rho*A*velocity*velocity)
print(drag_force)
plt.figure(1)
plt.plot(velocities, drag_force)
plt.title('Plot of Velocity v/s Drag Force')
plt.xlabel('Velocity')
plt.ylabel('Drag Force')
plt.grid()
plt.savefig('Velocity vs Drag Force')
plt.show()
# Drag Coefficient vs Drag Force
# Drag coefficient
c_d2 = [0,0.1,0.2,0.3,0.5,0.7,0.8,1]
# Frontal Area (m^2)
A = 0.1;
# Density (kg/m^3)
rho = 1.2;
# Bicycle velocity (m/s)
v = 12;
drag_force2 = []
for c in c_d2:
drag_force2.append(0.5*c*rho*A*v*v)
print(drag_force)
plt.figure(2)
plt.plot(c_d2, drag_force2)
plt.title('Plot of Drag Coefficient v/s Drag Force')
plt.xlabel('Drag Coefficient')
plt.ylabel('Drag Force')
plt.grid()
plt.savefig('Drag Coefficient vs Drag Force')
plt.show()
GRAPHS:
CONCLUSION:
1. From the first plot i.e, the plot of Velocity v/s Drag Force, Drag Force varies quadratically with respect to velocity. (If velocity becomes two times of earlier velocity then drag force becomes four times of earlier drag force.)
2. From the second plot i.e, the plot of Drag Coefficient v/s Drag Force, Drag Force varies linearly with respect to drag coefficient. (If drag coefficient becomes two times of earlier drag coefficient then drag force also becomes two times of earlier drag force.)