Project

FLOW OVER A BICYCLE USING PYTHON

Objective: To Calculate the drag force on a bicycle

Problem Statement:

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

The factors involved are Velocity, Drag coefficient, Frontal Area, Density of air.

Code for the program:

import math
import matplotlib.pyplot as plt
import numpy as np

# Case 1

# Constant Drag Coefficent 

cd = 0.8;

# Area Units - m^2

area = 0.1;

# Density Units - kg/m^3

density = 1.2;

# Velocity Units - m/s

velocities = [5,6,7,8,9,10,11,12]

# Drag Force Units - N or kg m/s^2

drag_force = []

# Calculating Drag Force using for loop for constant drag coefficent and varying velocities

for velocity in velocities:
	drag_force.append((0.5*(area)*(density)*(velocity)*(velocity)*(cd)))

# Drag Force Value for different velocities

print("Drag force value for varying velocities and constant drag_coefficent is ")
print(drag_force)

# Graph representing Velocity vs Drag Force

plt.plot(velocities,drag_force)
plt.title('Velocity vs Drag Force')
plt.xlabel('Velocity')
plt.ylabel('Drag Force')
plt.show()

# Case 2


"""
Drag Co-efficient (Unitless)
Drag Co-efficients of different shapes are mentioned below
Streamlined body = 0.04, Solid Hemisphere = 0.42 , Sphere = 0.5 , Cube = 0.8 , Bicycle = 0.9
Thin Disk = 1.1, Passenger Train = 1.8,Rectangular box = 2.1 
"""

drag_coefficents = [0.04,0.42,0.5,0.8,0.9,1.1,1.8,2.1]

drag_forces = [] 

# Constant Velocity

v = 10

# Calculating Drag Force for different drag_coefficents with constant velocity

for drag_coefficent in drag_coefficents:
	drag_forces.append((0.5*(area)*(density)*(v)*(v)*(drag_coefficent)))

# Drag Force value for different Drag coefficents

print("Drag force value for varying drag_coefficents and constant velocity is ")
print(drag_forces)

# Graph representing Drag Coefficent vs Drag Force

plt.plot(drag_coefficents,drag_forces)
plt.title('Drag Coefficent vs Drag Force')
plt.xlabel('Drag Coefficent')
plt.ylabel('Drag Force')
plt.show()

Plots:

Procedure:

The goal of this program is to generate two plots which are Velocity vs Drag Force and Drag Co-efficient vs Drag Force. I have done this successfully by using the following code mentioned in the above code block. I have used python as my programming language software to accomplish this task.

Firstly, I chose 8 values for different Drag coefficients to perform the computations on. Then I designated the other values such as area, density, and velocity. Later on, using the formula for calculation of the drag force I calculated it by substituting these quantities.

Then, I chose 8 values for different Velocities to perform the computations on. Then I used the same values of the area, density, and velocity. Later on, using the formula for calculation of the drag force I calculated it by substituting these quantities.

Finally, I plotted the graphs both Velocity vs Drag Force and Drag Co-efficient vs Drag Force as mentioned in the question.

We can observe from the graph 1, that as there is an increase in the velocity of the moving object, the drag force also tends to increase as drag force and velocity are directly proportional.

As in the case of graph 2, the increase in the drag coefficient is directly proportional to the drag force so the drag force also increases in value which is evident from the graph which is mentioned below, and also it is linear in nature.

Result:

Conclusion:

So, we can conclude that the cyclist must ride a bicycle which has a lower Drag Coefficient because it'll have a massive impact on the Drag force which results in the end. This can be achieved by using or designing a material that has the appropriate value which helps in making sure that the rider doesn't come in contact with a lot of force and he/she can easily ride past this force without compromising on the speed.

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.