Project

Flow over bicycle using Python.

AIM: To calculate drag force against a cyclist and to plot 1) velocity vs drag force.

2) drag coefficient vs drag force.

Coding to calculate the drag force and showing the relation between velocity and drag force is done by using Python.

# Calcuating velocity effect on drag force
import matplotlib.pyplot as plt

#Inputs

# Drag force cofficient
c_d = 0.8

# Frontal Area
A = 0.1

# Density 
rho = 1.2

# Bicycle Velocity
velocities = [5,6,7,8,9,10,11]
drag_forces= []

for velocity in velocities:
	drag_forces.append((0.5*A*rho*c_d*velocity*velocity))
	
plt.plot(velocities,drag_forces)
print (drag_forces)
plt.xlabel('Velocity')
plt.ylabel('drag_force')
plt.show()

LOGIC-

  • We set a null array named as drag_forces to store the output.
  • Used for loop to eliminate the long calculation, now for loop will select each value individually and put that value in the formula and store the value in that null drag_forces array created above.
  • Import matplotlib.pyplot as plt is used to make the plots using plt command.

OUTPUT & RESULTS

1) The drag force calculated for velocity[5,6,7,8,9,10,11] is [1.2, 1.7280000000000002, 2.3520000000000003, 3.072, 3.888, 4.8, 5.808] respectively.

2) We can observe that the drag force varies parabolically with respect to velocity.

3) Drag force is directly proportional to the square of the velocity.

Coding to show the relation between drag coefficient and drag force is done by using Python.

# Comparing drag force for differnet drag cofficient

import matplotlib.pyplot as plt 

#Inputs

#Frontal Area
A = 0.1

#Density
rho = 1.2

#Velocity
V = 2

#Different Drag cofficients
c_ds = [0.045, 0.07, 0.295, 1.28, 1.14]
drag_force=[]

for  c_d in c_ds:
	drag_force.append((0.5*A*rho*V*V*c_d))
plt.plot(c_ds,drag_force)
print (drag_force)
plt.xlabel('cofficient of drag force')
plt.ylabel('Drag force')
plt.show()

LOGIC

1) Same logic as used in previous codes.

2) Values of different drag coefficient for the same value of frontal area is taken d=from internet as shown above.

OUTPUT & RESULTS

1) The drag force calculated for drag coefficient [0.045, 0.07, 0.295, 1.28, 1.14] is [0.010799999999999999, 0.016800000000000002, 0.07079999999999999, 0.3072, 0.27359999999999995] respectively.

2) We can observe that the drag force varies linearly with the drag coefficient.

3) We can say that the drag force is directly proportional to the drag coefficient while keeping the other things constant.

4) The Downstream shape can be modified to reduce drag force.

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.