Project

Calculation of Drag Force for flow against a bicycle using Python

AIM

To calculate drag force against a cyclist.

GOVERNING EQUATIONS

`F_d=frac{1}{2}timesrhotimesAtimesv^2`

where

`F_d` =Drag Force,

`rho` =Density of the fluid which the body is resisting,

`A`=Frontal area,

`v`=Velocity

OBJECTIVES

  • To plot Velocity vs Drag force (taking Drag coefficient as constant)
  • To plot Drag co-efficient vs Drag force (taking velocity as constant)

INPUT DATA ASSUMED

  • Density of air(fluid against which body is resisting) is taken to be 1.225 kg/m3.
  • Frontal area of the cyclist is assumed to be 0.3 m2.
  • Velocity is assumed to vary from 1 m/s to 50 m/s.
  • The Velocity vs Drag Force plot is plotted taking Drag coefficient as 0.5.
  • The Drag co-efficient vs Drag force plot is plotted taking velocity = 10 m/s.

CODE

Programming Language used- PYTHON

#Program to calculate Drag Force against a cyclist
#Importing required modules
import matplotlib.pyplot as plt
import numpy as np

#Input variables
#Drag Coefficient(dimensionless)
c_d=0.5
#Frontal Area(in m^2)
A=0.3
#Density(in kg/m^3)
rho=1.225
#Velocity values(in m/s)
V=np.linspace(1,50,10)

#Making an empty array for Drag Force
F_d=[]

#Calculating the drag forces
for v in V:
	F_d.append(0.5*c_d*rho*A*v*v)

#Plotting the Velocity vs Drag Force(taking Drag Coefficient consatnt)
plt.figure()
plt.plot(V,F_d)
plt.xlabel('Velocity')
plt.ylabel('Drag Force')
plt.title('Velocity vs Drag Force')
plt.show()

#Calculating and plotting Drag Force vs Drag Coefficient (taking Velocity constant)
#Velocity(in m/s)
V1=10

#Drag coefficient for different shapes for same frontal area
#sphere=0.5, flat plate=1.28, prism=1.14, airfoil=0.045, bullet=0.295
C_d_diff=[0.5,1.28,1.14,0.045,0.295]

#Calculating the Drag Forces
F_d1=[]
for C_d in C_d_diff:
	F_d1.append(0.5*C_d*rho*A*V1*V1)

#Plotting the Velocity vs Drag Force(taking Drag Coefficient consatnt)
plt.figure()
plt.plot(C_d_diff,F_d1)
plt.xlabel('Drag Coefficient')
plt.ylabel('Drag Force')
plt.title('Drag Coefficient vs Drag Force')
plt.show()

PROCEDURE

  1. First, the required modules i.e. matplotlib and numpy were imported.
  2. Then the input variables were declared.
  3. An empty array for Drag Force is declared.
  4. Then the values of Drag Forces were calculated and stored using ‘for’ loop and ‘append’.
  5. Then the required plot of Velocity vs Drag Force was plotted.
  6. After that the different values of Coefficient of Drag for different shapes is stored in an array.
  7. Then the Drag forces are calculated as stored in the same way.
  8. Then the plot for Drag Coefficient vs Drag Force was plotted.

RESULTS

Plot for Velocity vs Drag Force

Plot for Drag Coefficient vs Drag Force

DISCUSSION

The velocity array is created by using ‘linspace’ command from the ‘numpy’ module.The drag force is calculated by taking the input values of Drag coefficient, density of fluid which body is resisting(in this case,air), Frontal area and velocity.

The drag force is calculated by the governing equation for different values of velocity varying from 1 to 50 m/s taking drag coefficient as 0.5.

Then these values are plotted using the ‘plt.plot’ command from the ‘matplotlib.pyplot’ module taking Velocity along x-axis and Drag Force along y-axis.

Similarly, Drag Force is calculated taking a constant value of velocity as 10 m/s and varying the values of Drag coefficient for different shapes. Then the Drag Force vs Drag coefficient is plotted.

It was found out from the plots that ‘Drag Force vs Velocity’ is a parabolic curve while ‘Drag Force vs Drag coefficient’ is a linear one.

CONCLUSION

From the program we can find the variation of Drag Force with Drag coefficient as well as Velocity.

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.