To write a PYTHON program to calculate drag force against the cyclist
Objective: To write a PYTHON program to calculate drag force against the cyclist.
Introduction: In fluid dynamics,drag force is a kind of force acting opposite to the relative motion of an object moving with respsct to the surrounding fluid.When a cyclist rides a bicycle it experiences a drag force.The drag force depends on the factor like density of the medium,frontal area,velocity & Drag Coefficient.
Formula:
Drag Force,F=.5*cd*A*V*V*rho
where,rho=density of the medium
A=Frontal Area
cd=coefficient of drag(Constant for a given shape)
V=Velocity
Problem Statement: Write a Python program to calculate drag force against a cyclist.
The factors involved are Velocity,Drag coefficient,Frontal Area,Density of air.
1. Write a program to plot Velocity vs Drag force.
2.Write a program to plot Drag Co-efficient vs Drag force. [For different frontal area there are different values of Drag Coefficient and with that we have to find drag force and plot it]
PYTHON PROGRAM:
1.This program is for plotting velcity vs drag force:
# Program to find drag force
# By Rahul Rai
import math
import matplotlib.pyplot as plt
#Inputs
#Drag Cofficient
c_d=.8
#Frontal Area(m^2)
A=2.1
#Density(kg/m^3)
rho=1.23
#Velocity
Velocities=[5,6,7,8,9,10,11,12]
Drag_Force=[]
for velocity in Velocities:
Drag_Force.append(.5*rho*A*c_d*velocity*velocity)
for i in range(0,8):
if i ==0:
print( "Velocity : Drag Force")
print(Velocities[i],"|",Drag_Force[i])
plt.plot(Velocities,Drag_Force)
plt.xlabel('Velocity')
plt.ylabel('Drag Force')
plt.show()
2. This program is for plotting Drag co-efficient vs Drag Force:
import math
import matplotlib.pyplot as plt
#Inputs
#Drag Cofficient
c_d=[.04,.09,.42,.47,.50,.8,.82,1.05,1.15] #Drag coefficients for different shapes
#Frontal Area(m^2)
A=2.1
#Density(kg/m^3)
rho=1.2
#Velocity
V=10
Drag_force=[]
for x in c_d:
Drag_force.append(.5*x*A*rho*V*V)
for i in range(0,9):
if i ==0:
print( "Coefficient of Drag : Drag Force")
print(c_d[i],"|",Drag_force[i])
plt.plot(c_d,Drag_force)
plt.xlabel('Coefficient of Drag')
plt.ylabel('Drag_force')
plt.show()
Procedure: In this we have to calculate the drag force which comes in effect when cyclist start moving.Basically we have to see the changes in Drag force on two parameters i.e with change in velocity and with change in drag coefficient.
So,first we have calculated the drag force on different velocities and plot a graph on that.
Now the second parameter i.e the drag coefficient we have taken different values of drag coefficient for the same frontal area(i.e. the shapes are different but frontal area is same.
Density of air is taken i.e.1.225 kg/m^3.
Now with the formula we have calculated the drag force.
Result: For different velocities Drag force are:
Plot:
For different drag coefficient drag forces are:
Plot: