Project

Flow over bicycle (Python)

AIM: To Calculate Drag Force against a cyclist using Python Program.

OBJECTIVES OF THE PROJECT:

  1. To calculate Drag Force on a bicycle moving through the air
  2. To plot Velocity vs Drag force and to plot Drag Co-efficient vs Drag force.

THEORY:

The force on an object that resists its motion through a fluid is called ‘drag’. When the fluid is a gas like air, it is called aerodynamic drag or air resistance. A drag force acts in opposition to the direction of motion and therefore has a negative effect on the velocity. A cyclist, for example, will constantly try to minimize drag so that they can increase their velocity.

GOVERNING EQUATIONS: The equation that represents the drag force, experienced by a body due to its movement through the fluid is given by,

⇒⇒ FD=0.5⋅ρ⋅A⋅v2⋅CdFD=0.5⋅ρ⋅A⋅v2⋅Cd

FDFD = Drag Force experienced by a body (NN),

ρρ = Density of the fluid through which the body is moving (kg/m3kg⁄m3 ),

AA = Projected frontal area of the body which is perpendicular to the fluid flow direction (),

vv = Velocity of the body relative to the fluid around them (msms),

CdCd= Drag coefficient, a dimensionless quantity.

PROCEDURE:

  1. First, we will assume the density of air to be 1.2041 kgm3kgm3, which is at and 101.325 kPa, and the drag coefficient to be 0.80.
  2. The frontal area is assumed 0.5 m2m2 and drag force is calculated with different values of velocity stored in the array to understand the variation of velocity with drag force in Python.
  3. At first drag_forces array is kept null and for loop is executed for different values of velocity array and drag force is calculated using the given formula and stored in drag_forces array using 'append' command.
  4. All the values of drag_forces calculated are displayed using the print command and plotted using 'plt.plot' and displayed using 'plt.show' command.
  5. For the same frontal area, the coefficient of drag varies for different shapes, so we will take different values of drag coefficient and observe the variation of drag coefficient with drag force keeping all other parameters to be constant. The same process will be applied for c_d array as that of velocity_array.

BODY OF THE CONTENT :

(i) Python Code for calculating drag force and to plot variation between velocity and drag force -

# A program to calculate drag forces over a bicycle and to plot variation between velocity and drag force
import matplotlib.pyplot as plt
# Inputs

# Drag coefficient of air
c_d = 0.8

# Frontal area(m^2)
A = 0.5

# Density of air (kg/m^3)
rho = 1.2041

# Velocity (m/s)
velocity_1 = [10,20,30,40,50,60,70,80,90]

drag_forces = []

for velocity in velocity_1:
	drag_forces.append((0.5*rho*A*velocity*velocity*c_d))
	
print(drag_forces)
plt.plot(velocity_1,drag_forces)
plt.xlabel('Velocity (m/s)')
plt.ylabel('Drag forces (N)')
plt.title('Variation between Velocity and Drag_forces')
plt.show()

(ii) Python Code for calculating drag force and to plot variation between drag coefficient and drag force for the same frontal area-

# A program to calculate drag forces over a bicycle  and to plot variation between drag coefficient and drag force
import matplotlib.pyplot as plt

# Inputs

# Drag coefficient
'''drag coefficient for different shapes having same frontal area
 Sphere = 0.50
 Solid Hemisphere = 0.42
 Cube = 0.8
 Thin disk = 1.12
 Squared flat plate = 1.17'''
c_d_1 = [0.42,0.5,0.8,1.12,1.17]

# Frontal area(m^2)
A = 0.5
# Density (kg/m^3)
rho = 1.2041
# Velocity (m/s)
velocity = 20
drag_forces = []

for C_d in c_d_1:
	drag_forces.append((0.5*rho*A*velocity*velocity*C_d))
	
print(drag_forces)
plt.plot(c_d_1,drag_forces)
plt.xlabel('C_d ')
plt.ylabel('Drag forces (N)')
plt.title('Variation between Drag coefficient and Drag_forces')
plt.show()

OUTPUT :

  • The following output is for the program (i) and drag forces are calculated and displayed here.

The data obtained are entered into an excel sheet and from there the plot obtained is as -

  • The following output is for the program (ii) and drag forces are calculated and displayed here.

CONCLUSION :

  • The greater the velocity of a body through a fluid, the greater the drag force,i.e., drag force becomes four times as velocity doubles and it is clearly observed from figure 1 as,

F∝V2F∝V2

  • As the value of CdCd increases, correspondingly drag force also increases. Hence such shapes are chosen for designing whose CdCd is less as,

F∝CdF∝Cd

  • Furthermore, drag force is directly proportional to the density of the air, ρρ, which decreases with altitude, thus one way to experience less drag is to move from the sea level to the mountains.

F∝ρ

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.