Calculation of Drag Force on a bicycle by PYTHON program
Aim:
To calculate drag force on a bicycle by PYTHON program
Governing equation:
Equation that play main role to calculate drag force is given below:
f_d=0.5*rho*A*v^2*c_d
where, f_d= drag_force,
rho=density,
A= frontal area of the man with bicycle,
v= velocity,
c_d= drag coefficient,
Units:
f_d = kgm/s^2,
rho = kg/m^3,
A = m^2,
v = m/s,
After putting the units in the main equation and calculating , we get c_d = 0.8.
So c_d is unitless.
Here, from the governing equation , we get that drag force is directly proportional to the square of velocity.
As here a man is cycling so the frontal area is also changeable.
Here we are interested in calculating the wind resistance that we are calling as a drag force.
Objective:
The main objective of this project is to calculate drag force(wind resistance) on a bicycle by PYTHON programming.
Workflow :
- Values of density, area, velocity, drag coefficient are considered as per requirement,
- Values are putting in the governing equation,
- Getting values of drag force after calculating,
- Printing the final value of drag force(f_d),
- Plotting the graph drag force(y-axis) vs velocity(x-axis)
Brief content of this project:
This project has been done by PYTHON programming.
The code of the program has been attached below:
#Calculation of drag force of a bicycle using PYTHON
import matplotlib.pyplot as plt
#taking inputs
#drag coefficient
cd=0.8
#density(air)
rho=1.225
#frontal area
a=0.7
#velocity of the bicycle
v=[5,10,15,20,25]
#drag force
drag_forces =[]
for i in v:
drag_forces.append((0.5*cd*rho*a*i*i))
print(drag_forces)
#plotting of graph
plt.plot(v,drag_forces)
plt.xlabel('VELOCITY')
plt.ylabel('DRAG_FORCE')
plt.show()
#plotting of drag force vs drag coefficient
#drag force
import matplotlib.pyplot as plt
#taking inputs
#frontal area
a = 0.7
#density of air
rho = 1.225
#velocity of the bicycle
v = 22
#drag coefficient
cd=[0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9]
#drag forces
drag_forces = []
for i in cd:
drag_forces.append(0.5*rho*a*i*v*v)
print(drag_forces)
plt.plot(cd,drag_forces)
plt.xlabel('DRAG COEFFICIENT')
plt.ylabel('DRAG FORCE')
plt.show()
Algorithm of the program:-
1)Firstly inputs are taken
2)Velocities are stored into an array
3)For loop is used to calculate drag force
4)The 'append' command has been used to store the drag forces on the empty array.
5)plot command is used to plot graphs
6)label command is used to show the x-axis, y-axis properties.
Results:-
Plots:-
Conclusion:-
Through this program, we have learned how to calculate drag force that is nothing but wind resistance. In real-world problems, we can use this program to easily find out the solution to such type of problem not only for a bicycle but also for any vehicle it may be in air or road, etc. Finally, by the graph, we can easily understand the solution to such type of problem and definitely the graph is different for different values.