Project

Calculation of drag force against a cyclist using python.

DRAG FORCE:- A drag force is the resistance force caused by the motion of a body through a fluid, such as water or air. A drag force acts opposite to the direction of the oncoming flow velocity.

Program to calculate Drag Force against cyclist :

a. Program to plot Velocity vs Drag Force.

b. Program to plot Drag Coefficient vs Drag Force.

The drag force is calculated by formula -

Fd = 0.5*Density of Air*Frontal Area*velocity^2*Drag Coefficient

i.e. Fd = 0.5*rho*A*v^2*cd where rho = density (kg/m^3)

A = Frontal Area (m^2)

v = velocity (m/s)

cd (or)c_d = drag coefficient

Fd = drag force

For both the programs values of drag coefficient is considered from following table:

a. Program to plot Velocity vs Drag Force.

Inputs for the program:

cd (or) c_d = 0.9

rho = 1.2 kg/m^3

A = 0.1 m^2

consider velocities as [ 1,2,3,4,5,6,7,8,9 ] m/s

# python program to calculate drag force against cyclist.

#(a)To write a program to plot velocity vs drag force.

import matplotlib.pyplot as plt 

#inputs
#drag coefficient for bicycle
c_d = 0.9

#density of air 
rho = 1.2

#frontal area
A = 0.1

#velocity of bicycle 
velocities = [1,2,3,4,5,6,7,8,9]
drag_force = []

for velocity in velocities: 
	drag_force.append((0.5*rho*A*velocity*velocity*c_d))

print (drag_force)
plt.plot(velocities,drag_force,'-o')
plt.xlabel('velocity')
plt.ylabel('drag force')
plt.title('velocity vs drag force')
plt.grid()
plt.show()	

Output :- Results are printed and graph is plotted.

Printed result -

Graph obtained -

Explanation :-

  • The above inputs are considerd in order to find the drag force experianced by the cyclist. Drag coefficient for cycle is considered as 0.9 (standard value).
  • For finding drag force for multiple velocities use of for loop is essential. Range operator(:) used to print all the values of v.
  • To print the values of drag forces append command is used in order to print all the values from begning to end of execution.
  • By using plot command , velocity vs drag force graph is obtained. The plot represents a parabolic curve as with the raise in velocity the drag force increases.
  • Thus Drag force is directly praportional to twice of velocity.

b. Program to plot Drag Coefficient vs Drag Force.

Inputs for the program:

rho = 1.2 kg/m^3

A = 0.1 m^2

v = 1 m/s

values for drag coefficient for different shapes are;

cube = 0.8

hollow semi-sphere = 0.38

solid hemisphere = 0.42

sphere = 0.5

rectangle = 2.1

Hollow semi cylinder = 1.2

# python program to calculate drag force against cyclist.

#(b)To write a program to plot drag coefficient vs drag force

import matplotlib.pyplot as plt

#inputs
#density of air 
rho = 1.2

#frontal area
A = 0.1

#velocity of bicycle (m/s)
v = 1

#drag coefficients for various shapes 
drag_coeff = [0.8 ,0.38, 0.9, 0.42, 0.5, 2.1, 1.2]
drag_force = []

for c_d in drag_coeff:
	drag_force.append((0.5*rho*A*v*v*c_d))

print (drag_force)
plt.plot(drag_coeff,drag_force,'-o')
plt.xlabel('Drag coefficient')
plt.ylabel('Drag force')
plt.title('Drag cofficient vs Drag force')
plt.grid()
plt.show()		

Output :- Results are printed and graph is plotted.

Printed Result -

Graph Obtained -

Explanation :-

  • As it is mentioned that for same frontal area , the coefficient of drag varies for different shapes by maintaining the velocity as constant i.e. v=1.
  • The standard values for coefficient drag are considered to obtain drag forces.
  • Range operator(:) used to print the drag forces. To print the values of drag forces append command is used in order to print all the values from begning to end of execution.
  • By using plot command , drag coefficient vs drag force graph is obtained.
  • It is observed that both drag force and drag coefficient has a linear trend. Hence if drag coefficient increases the drag force also increases.

From the above two cases it is concluded that the drag coefficient should be reduced in order to reduce the drag force. Hence to maintain the less drag force the cyclist keeps on changing his position when exposed to wind resistance.

Your portfolio, next

Ship work like this
in your own course.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.