Python program to calculate the Flow Over Bicycle
Introduction
Cyclist experiences drag force while in motion. it is basically the resistance to the wind which he has to overcome in order to keep moving forward. So this study deals with the calculation of drag force and generating respective plots.
1. Program to plot velocity vs drag force.
2. Program to plot drag coefficient vs drag force.
Drag force depends on factors like:
1.The density of the air through which the cyclist is moving, rho(kg/m^3)
2.Frontal area, A(m^2)
3.Drag coefficient, c_d(non-dimensional quantity)
4.Velocity, v(m/s)
The formula for calculating drag force is:
Drag Force, F=0.5*rho*A*c_d*v^2
The program for calculating drag force and plots of different parameters is shown below.
"""
Program to calculate drag force against a cyclist
"""
import matplotlib.pyplot as plt
import numpy as np
#inputs
#Coefficient of drag
c_d=np.linspace(.001,2.1,10)
print(f'Drag coefficients={c_d}')
#Frontal area(m^2)
A=0.1
print(f'Frontal area={A}')
#density of air(kg/m^3)
rho=1.2
print(f'Density of air={rho}')
#Bicycle velocity
v=np.linspace(1,10,10)
print(f'Velocities={v}')
drag_forces=[]
#Drag forces
for velocity,cd in zip(v,c_d):
drag_forces.append(0.5*rho*A*cd*velocity*velocity)
print(f'Drag forces={drag_forces}')
#Program to plot Drag coefficient vs Drag force
plt.plot(c_d,drag_forces)
plt.xlabel('Drag Force')
plt.ylabel('Drag Coefficient')
plt.title('Drag Coefficeint vs Drag Force')
plt.show()
#Program to plot Velocity vs Drag Force
plt.plot(v,drag_forces)
plt.xlabel('Drag Force')
plt.ylabel('Velocity')
plt.title('Velocity vs Drag Force')
plt.show()
Output
Drag coefficients, Frontal area in m^2, Density of air in kg/m^3, Velocities in m/s required for the calculation are shown in the result. The value of Drag forces in Newton after computation is shown as an array These values are used to plot the required graphs.
Plots
Drag Coefficient vs Drag Force:
Drag coefficient(c_d) is a constant for a particular shape but as the shape changes, it also changes c_d.
Velocity vs Drag Force:
Drag Force(F) is proportional to the square of velocity(v) according to the formulae.
Conclusion
The drag force was calculated and plots of different parameters were studied based on the generated plots.