Project

Flow over bicycle using Python

ABSTRACT:

The main aim of this project is to calculate drag force for different velocities of a cyclist, by maintaining other parameters like frontal area, density, and coefficient of drag constant. Understand the relation between the two by plotting between drag force and velocity. This code also contains the calculation of drag force for different drag coefficients of different objects having the same frontal areas, velocities, and density. Understand the relation between the two by plotting between drag force and coefficient of drag.

THEORY:

In fluid dynamics, drag (sometimes called air resistance, a type of friction, or fluid resistance, another type of friction or fluid friction) is a force acting opposite to the relative motion of an object moving with respect to a surrounding fluid.

a) Calculation of Drag Force:

Drag Force = `1/2`*Cd*`rho`*A*`V^2`

Where Cd = Coefficient of drag`

`rho` = Density of air`

A = Frontal Area

V = Velocity of Bicycle

b) Variation of Coefficient of Drag with for different shapes:

For the same frontal area with the variation of shape the coefficient of drag changes. The following figure shows the values of the Coefficient of Drag for different shape:

PYTHON CODE TO CALCULATE DRAG FORCE FOR VARIOUS VELOCITIES:

#Program to calculate drag coefficient

#Importing math library
import matplotlib.pyplot as plt

#Coefficient of drag
c_d = 0.8

#Frontal Area
A = 0.1

#Density of air
rho = 1.2

#Velocity of the bicycle
velocities = [10,20,30,40,50,60,70]
drag_forces = []

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

plt.plot(velocities,drag_forces)
plt.xlabel('Velocity')
plt.ylabel('Drag Force')
plt.show()

PYTHON CODE TO CALCULATE DRAG FORCE FOR VARIOUS DRAG COEFFICIENTS:

#Program to calculate drag coefficient for various drag coefficients of same frontal area

#Importing math library
import matplotlib.pyplot as plt

#Frontal Area
A = 0.1

#Density of air
rho = 1.2

#Velocity of the bicycle
V = 20

#Coefficient of drag for Sphere, Hemisphere, cone, cube etc
Cd = [0.47,0.42,0.5,1.05,0.8,0.82,1.15,0.04,0.09]
drag_forces = []

for C_d in Cd:
	drag_forces.append((0.5*C_d*A*V*V))

plt.plot(Cd,drag_forces)
plt.xlabel('Coefficient of drag')
plt.ylabel('Drag Force')
plt.show()

Steps:

  • In both the codes matplot library has been called to use the plot function. Inputs like frontal area, the coefficient of drag, the density of air, velocity of the bicycle are defined
  • Using the For loop the drag force has been calculated in both the codes using append function, it stores every value of drag force as the loop proceeds
  • Using plot command the graph has been plotted in both the codes and corresponding labels were given to x-axis and y-axis.

PLOTS:

a) Drag force Vs Velocity:

b) Drag Force Vs Coefficient of Drag

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.