FLOW OVER A BICYCLE USING PYTHON
by FLOW OVER A BICYCLE
intro:
whenever a rider cycling at different cycling positions, the rider opposes the different drags due to the opposing force created by the air. Due to the different changing positions of the rider , there are different frontal areas. Here we will take the constant frontal area due to unavailable of data. here we will calculate the drag force on the bicycle and the rider.here coefficient of drag is constant i.e 0.8.
Frontal Area(A): the front area which is exposed by the air
A=0.1
density of air(rho): 1.2 kg/m^3
in first graph we will take the different velocities to plot the graph between drag force and velocity,
to know the variation and trend.
Formula to calculate the drag force
dragforce=0.5*density*frontal area*coefficient of drag*v^2
code 1:
"""
program to calculate the drag_force
"""
import matplotlib.pyplot as plt
#inputs
c_d=0.8
#frontal area(m^2)
A=0.1
#density of air(kg/m^3)
rho=1.2
#velocity of the bicycle
velocities=range(2,30,1)
drag_force=[]
for velocity in velocities:
drag_force.append((0.5*rho*A*c_d*velocity*velocity))
print(drag_force)
plt.plot(velocities,drag_force)
plt.xlabel('velocity m/s')
plt.ylabel('drag_force')
plt.show()
by executing the above we will get the following graph
the above graph depicts that the drag force is directly propartional to the velocity i.e the plot we will grt be in the parabolic form .
code 2:
here the velocity made constant i.e v=0.3
and the coefficent of the drag depends upon the different surface areas , that means it do have different values, but due to the experimental basis we have taken the constant values
"""
ploting the graph between the drag_force and the coefficient of the drag
"""
import matplotlib.pyplot as plt
#coefficient of drag varries on the shape of the object
#here coefficient drag was assuemed
rho=1.2
A=0.1
#defining velocity
v=0.3
#defining coefficent of drag
c_ds=[0.8,1,1.2,1.4,1.6,1.8,2,2.2,2.4,2.6,2.8,3.0,3.2,3.4,3.6,3.8,4.0,4.2,4.4,4.6,4.8,5.0,5.2,5.4,5.6,5.8,6.0]
drag_forces=[]
#calculating the drag force
for cd in c_ds:
drag_forces.append(0.5*rho*A*cd*v*v)
print(drag_forces)
plt.plot(c_ds,drag_forces)
plt.xlabel('coefficent of drag')
plt.ylabel('drag force')
plt.show()
by executing the above graph we get the below graph
here we are getting the straight line i.e increase of the component results to increase of other entity. here the coeffient of drag is directly proportional to the drag force.