Flow over Bicycle- Python
Drag Force Calculations for Flow Over Bicycle
1.AIM:
- To calculate drag force acting on a cyclist driving the cycle using Python.
2.GOVERNING EQUATIONS IF ANY:
`(F)= 1/2 ρAV^2 C_d`
Where, `ρ`= density of the fluid in which cycle and cyclists exist ()
A= Frontal area / front area of exposure of cyclist ()
v= velocity of the cyclist respective to the fluid ()
C_d= Drag coefficient (unitless)
Pressure = and thus, Drag Force = Pressure x Area x (some constant)
So, we get Drag Force (F) = A
3.OBJECTIVES OF THE PROJECT:
- To find the total drag force acting on cyclist and cycle travelling with some velocity through a fluid medium.
- Write a python program to calculate drag force against a cyclist.
- Write a program to plot Velocity vs Drag force.
- Write a program to plot Drag Co-efficient vs Drag force.
4.FLOW OF THE PROJECT
- Assign values to the input variables.
- Get the value of drag force using the formula.
- Plot the graphs mentioned in the objectives.
5.PYTHON CODE
- plot for velocity vs drag force
import matplotlib.pyplot as plt
#plot for velocity vs drag force
#inputs
#Coefficent of Drag as an array
cd=0.8
#Density (kg/m^3)
rho=1.2
#frontal Area(m^2)
A=0.1
#velocity as an array (m/s)
v=[4 ,4 ,6 ,8 ,10 ,12]
c=0.5 #for putting in formula
drag_force=[]
for velocity in v: #for loop to repeat process for all values of velocity
a= c*cd*rho*A*velocity*velocity #Drag force value stored in a
drag_force.append(a) #append all the values in drag force list.
plt.figure(1)
plt.plot(v,drag_force) #plot the data
plt.xlabel('velocity') #label x axis as velocity
plt.ylabel('Drag Force') #label y axis as Drag Force
plt.savefig("plot1.png") #save
plt.show() # show
- Plot for cd and Drag Force
import matplotlib.pyplot as plt
#plot for cd and Drag Force
#inputs
#Coefficent of Drag as an array
cd=[0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.15]
#Density (kg/m^3)
rho=1.2
#frontal Area(m^2)
A=0.1
#velocity as an array (m/s)
v=8
c=0.5 #for putting in formula
drag_force=[]
for Coefficent in cd: #for loop to repeat process for all values of velocity
a= c*Coefficent*rho*A*v*v #Drag force value stored in a
drag_force.append(a) #append all the values in drag force list.
plt.figure(2)
plt.plot(cd,drag_force) #plot the data
plt.xlabel('cd') #label x axis as velocity
plt.ylabel('Drag Force') #label y axis as Drag Force
plt.savefig("plot2.png") #save
plt.show() # show
6.OBSERVATION:
Figure 1: Velocity vs. Drag Force
Figure 2: Drag Coefficient vs Drag Force
7.CONCLUSION:
- From figure 1, we can say that as velocity increases, drag force also increases. The plot verifies the quadratic nature of the direct proportion of drag force with velocity.
- From figure 2, we can say that as drag coefficient increases, drag force also increases. The plot verifies the linear nature of direct proportion of drag coefficient with drag force.