Drag Force estimation over a bicycle in PYTHON
AIM : Program in PYTHON to calculate drag force against a cyclist .
1) Program to plot velocity v/s drag force.
2) Program to plot drag coefficients v/s drag forces.
THEORY : Drag is the resistance attributed to an object, in this case its air resistance . It is a product of an objects drag cofficient (cd) , density of the fluid ( ρ), square of its velocity ( v^2)and its size , critically its frontal area ( area ).
D = 1/2 * ρ*v^2 * area * cd
source link : https://www.cyclingpowerlab.com/CyclingAerodynamics.aspx
PYTHON CODE :
1) velocity v/s drag force :
""" PROGRAM TO FIND THE DRAG FORCE OVER A BICYCLE ( VELOCITY V/S DRAG FORCE) """
import matplotlib.pyplot as plt # importing the plotting features from liberary matplotlib
# INPUTS
rho = 1.225 # density of air in kg/m^3
area = 0.32 # frontal area in m^2
c_d = 0.88 # coefficient of drag
velocities = [10,20,30]
dragforces = [] # saving the values in an array
for velocity in velocities:
dragforces.append((0.5*c_d*area*rho*velocity*velocity)) # all calculated velocities are appended into the drag froce
# GRAPH PLOTS
plt.plot(velocities,dragforces)
plt.xlabel('velocity')
plt.ylabel('drag')
plt.show()
GRAPH :
2) drag coefficients v/s drag forces :
"""PROGRAM TO FIND THE DRAG FORCE OVER A BICYCLE ( DRAG FORCE v/s DRAG COEEFICIENT)"""
import matplotlib.pyplot as plt # importing the plotting features from liberary matplotlib
# INPUTS
c_ds = [1.15,1,0.88,0.70] # coefficient of drag for different positions
area = 0.32 # frontal area in m^2
rho = 1.225 # density of air in kg/m^3
velocity = 120
dragforces = []
for c_d in c_ds:
dragforces.append((0.5*c_d*area*rho*velocity*velocity)) # appending the values of c_d into dragforces
# GRAPH PLOTS
plt.plot(dragforces,c_ds)
plt.xlabel('Drag forces')
plt.ylabel('Drag coefficient')
plt.show()
GRAPH :
ERRORS :
correction : line 7 : change c_d into c_ds