Project

finding flow over bicycle using python

Aim: To write a Python program to calculate drag force against a cyclist.

Consideration:

1. The frontal area of a bicycle with the rider is considered to be 0.3623 m^2

2.For plotting the velocity and drag force consider constant drag coefficient of 0.85 which is the maximum drag force condition and we get the plot for the maximum values and values of velocity from 0 to 7.25 m/s

3.For plotting the drag coefficient vs drag force consider the velocity to be 5.36 m/s which is considered to be average bicycle velocity and values of drag coefficient as 0.6 to 0.85 as typically, the drag coefficient of a cyclist ranges from approx0.6 for a streamlined time-trial position to >0.8 for an upright position

Let the value of density of air be 1.225 kg/m^3

We know:

Now let's find out the values of drag force taking the drag coefficient constant and various values of velocities and plot the values of drag force and velocities

Procedure:

  • insert the matplotlib.pyplot and numpy
  • put all inputs
  • create the empty vector for the drag force
  • use for loop to use different values in drag force formula (first for values of velocity and then for value of the coefficient of drag
  • append the drag force with the formula of drag force to save the new values in arrays
  • plot the graph and save

Code:

#program to calculate the drag force

import matplotlib.pyplot as pyplot
import numpy as np

# inputs

# drag coefficient 
C_d = 0.85
c_d = [0.6,0.65,0.7,0.75,0.8,0.85]

# Area m^2
A = 0.3623

# density of air kg/m^3
rho = 1.225

# velocity m/s
V = [0.25,0.75,1.25,1.75,2.25,2.75,3.25,3.75,4.25,4.75,5.25,5.75,6.25,6.75,7.25]
v = 5.36 

#calculation taking drag coefficient constant considering maximum drag

drag_force = []

for i in V:
    drag_force.append((rho*A*i*i*C_d*0.5))

#calulation taking velocity constant considering average velocity

Drag_force = []

for j in c_d:
	 Drag_force.append((rho*A*v*v*j*0.5))

#plotting
pyplot.figure()
pyplot.plot(V,drag_force)
pyplot.xlabel('Velocity')
pyplot.ylabel('Drag_force')
pyplot.savefig('V vs drag_force')
pyplot.show()

pyplot.figure()
pyplot.plot(c_d,Drag_force)
pyplot.xlabel('Velocity')
pyplot.ylabel('Drag_force')
pyplot.savefig('drag_coefficient vs drag_force')
pyplot.show()
Results:
Conclusion:
As drag force directly depends on the square of velocity the curvature shows parabolic showing that as speed increases the values of the drag force will be much greater as compared to the value of speed
and in drag coefficient vs drag force curvature shows that the drag force increases proportionally to the coefficient of drag as the coefficient of drag is directly proportional to the 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.