Project

FLOW OVER A BICYCLE( Python )

AIM: To calculate drag force against a cyclist using Python.

THEORY:

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.

The given below equation is used to calculate the drag force on a body which is moving with some velocity in a fluid medium.

Various parameters affect the value of drag force but the most essential is the velocity with which it was moving (as it is directly proportional to the square of velocity).

OBJECTIVE:

  1. Write a program to plot Velocity vs Drag force.
  2. Write a program to plot Drag Co-efficient vs Drag force.

GOVERNING EQUATION:

`F_(d )= (1/2).ρ.A.v^2.C_d`


`F_(d )` is the drag force,

`ρ` is the density of the fluid,

`v^2` is the speed of the object relative to the fluid,

`A` is the cross-sectional area, and

`C_d` is the drag coefficient.

INPUT VALUES:

Drag Co-efficient values for different shapes-

`ρ = 1.2`

`A = 0.1`

`C_d = 0.75`

PROGRAM 1: To plot Velocity vs Drag force

# Program to calculate the drag force over a bicycle and to plot it against Velocity
import matplotlib.pyplot as plt

# Inputs

# Drag coefficient 
c_d = 0.8

# Frontal area(m^2)
A = 0.1

# Density (kg/m^3)
rho = 1.2

# Bicycle Velocity(m/s)
Velocities = [5,6,7,8,9,10,11,12]

Drag_force = []  # empty list for storing values

for Velocity in Velocities:
    Drag_force.append((0.5*rho*A*c_d*Velocity*Velocity))

plt.plot(Velocities, Drag_force,'-*') 
plt.xlabel('Velocity')
plt.ylabel('Drag_force')
plt.title('Velocity v/s Drag force')
plt.show()

OUTPUT 1: Plot obtained for Velocity vs Drag force

By visualizing the graph, we can say that velocity varies parabolically with the drag force, i.e. drag force varies with the velocity square with which cyclist is moving.

PROGRAM 2: To plot Drag Co-efficient vs Drag force

# Program to calculate the drag force over a bicycle and to plot it against Co-efficient of drag
import matplotlib.pyplot as plt

# Inputs

# Drag coefficient 
C_D = [0.045,0.295,0.5,1.14,1.28]

# Frontal area(m^2)
A = 0.1

# Density (kg/m^3)
rho = 1.2

# Bicycle Velocity(m/s)
Velocity = 10


Drag_forces = []  # empty list for storing values

for c_d in C_D:
    Drag_forces.append(0.5*rho*A*c_d*Velocity*Velocity)

plt.plot(C_D, Drag_forces,'-*') 
plt.xlabel('Coefficient of drag')
plt.ylabel('Drag_force(N)')
plt.title('Drag Co-efficient v/s Drag force')
plt.show()

OUTPUT 2: Plot obtained for Drag Co-efficient vs Drag force

The above plot provides a clear idea of drag force dependency on the drag coefficient. Therefore ,minimum resistance is face by the a streamlined body.

EXPALNATION OF THE CODE:

  1. Initially, at the beginning of both the programs we first import the libraries which are used to plot graphs.
  2. Then, we write the inputs which includes drag co-efficient, frontal area, density.
  3. For the first program, an array of velocities is created since we have to plot the graph between the velocity and the drag force. Therefore, we need the different values for velocity.
  4. Similarly, for the second program, we have created an array of the drag co-efficient for plotting the different values drag co-efficient against the drag force.
  5. Thereafter, for loop is used for the iteration of velocities and drag coefficient in both the program 1 and program 2, respectively. And after that we have used append command to append (or add) the values for the drag force every time and storing them.
  6. At last, we have the plotted the graphs for the particular problems separately.

ERRORS OCCURED:

  1. Firstly, I have not saved the program in the proper extension (.py), so I didn’t got any output. Then, I have corrected this mistake by saving it in the .py extension.
  2. Another mistake I have done is, I haven’t used the semicolon (:) after creating a for loop. Corrected by using the semicolon (:).

CONCLUSION: We have created the plots for the given condition. By observing ,we can say that there are various possible ways to reduce drag force but only few parameters to vary.

And we get a clear idea of the drag force's dependency and can say that streamlined bodies experience minimum 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.