Project

Project on Drag force applied on a solid object moving through air (PYTHON)

Project on Flow over bicycle.

Objective of the project:-- Writing code in PYTHON to calculate the dragforce experienced by bicyclist for different velocities of bicycle & for different values of drag-coefficient and to plot dragforce vs velocity , dragforce vs drag-coefficient.

Brief discussion on the project:--

Drag force-- It is the force experienced by a solid object moving through a fluid & it is opposite to the direction of motion of the object. It is kind of resistive force which depends upon the relative velocity(v) of the of the object with respect to fluid, density of the fluid (d), frontal area of the moving object (A), & drag-coefficient of the object(Cd). Drag co efficient is a dimensionless quantity & its value depends on the shape of the object. But for a perticular shape, the Cd also depends upon the Renolds number. Value of Cd decreases from laminar flow (low Reynolds number ) to tubulent flow(high Reynolds number).

Drag equation:--The equation used to calculate dragforce is given below'

F=0.5 x Cd x A x d x V^2

Where F = Drag force, Cd = Drag Coefficient, A = Frontal area of the object, d = density of the fluid, V = Velocity of the object through the fluid.

In our project, a bicyclist is moving through air. Here the the cyclist experiences a dragorce when moving through air. We consider the flow with respect to the byclist as turbulent, so here the Reynolds number is high.

Problem statement -- 1) Here with the help of Drag equation given above, we calculate the Drag force for different velocities & we plot the dragforce with respect to the velocity. 2)Keeping velocity constant, we calculate the dragforce for different values of drag coefficient ( for same frontal area having different shape of solid object moving through air) and plot the dragforce with respect to drag coefficient.

Solution:--

All these are to be done through a program in PYTHON.

1) The code to calculate the dragforce for different velocities & to plot the dragforce w.r.t. velocity are given below

""" Program in Python to calculate the Dragforce experienced by bicyclist with 
different velocities of bicycle and ploting of Dragforce with velocity"""
import math
import matplotlib.pyplot as plt 
import numpy as np

# Here function is used & velocity-array is passed as one of input arguments of the function

def dragforce(C,A,d,v):
	Drag_force=[]
	for i in v:
		F=0.5*C*A*d*(pow(i,2))
		Drag_force.append(F)
	print('Values of Dragforce')	
	print(Drag_force)
	plt.plot(v,Drag_force)
	plt.xlabel('Velocity')
	plt.ylabel('Drag force')
	plt.title('Variation of Dragforce with Velocity of biCycle')
	plt.show()

#Drag Coefficient
C=0.8

#frontal area (m^2)
A=0.5

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

# Bycycle velocity (m/s)
# Here numpy module is used to create the velocity list/array by linspace comand.
v=np.linspace(5,125,25)
print('Values of velocity')
print(v)
# Function is called & input arguments are provided
dragforce(C,A,d,v)	

Explanation of code:--

Three modules are impoted for runing the the code. 'math' module for mathemetical calculation, 'matplotlib.pyplot' as 'plt' for plotting the graph, & 'numpy' module as 'np' for using linspace command.

First a function is defined called 'dragforce' having input arguments as C, A d, v whre C= drag coefficient, A = frontal area, d= dencity of air, v = velocity of bicyclist'. In the function defination, first an empty list(array) 'Drag_force' is declared. A for-loop is made for different velocities to calculate the Dragforce(F) & append the Drag_force array. Besides this in the function the dragforces are also printed & dragforces are plotted against different velocities. Here 'pow' command is used to put exponant of 'i' which is 2.

After defining function, the values of C, A, d are declared. With the help of 'linspace' command , a list/ array for v is created & in the list there are 25 elements.

The function 'dragforce' is called with input arguments C, A, d, v. The function calculate the dragforce for 25 valuse of velocity & plot the dragforce for for all those velocities.

Results:- Screen shot of the result is given below.

Discussion on result:--The first screenshot shows the list/array of velocities & the calculated values of dragforce for different values of velocity in the in the command window of sublime text editor.

The second screenshot shows the plot of dragforce vs velocity. From the plot we find that the dragforce varries with velocity in parabolic curve (X=4.a.Y^2) & the axis of the parabola is the vertical Dragforce-axis & vertex is origine (0,0). This is also confirmed by the drag equation, which states that the dragforce is propotional to the square of velocity provided other parameters(C,A,d) are constant. The drag equation can be written as F=k.v^2 where F is dragforce, v= velocity & k is the 4 times the distance between vertex & focus of the parabolic curve(constant k=0.5 C A d). So here we can say the 4a = k

The 2nd part of the challenge is to calculate the dragforce for different values of drag coefficient, kepping velocity constant & to plot the dragforce with respect to the different values of drag coefficient. The relevent code in PYTHON is given below.

"""Program in Python to calculate Dragforce for different  
values of Drag co-efficients and ploting of Dragforce with  drag coefficients"""

import math
import matplotlib.pyplot as plt

"""
Drag Coefficient(C_d)
C_d value of different shapes are given below
Half sphere-0.42, Sphere-0.47, Cone-0.5, Angled cube-0.8,
Long cylinder-0.82, Short cylinder-1.15
"""
#Array of C_d is declared below
C_d=[0.4,0.42,0.47,0.5,0.55,0.6,0.65,0.7,0.75,0.8,0.82,0.9,0.95,1.05,1.1,1.15,1.2,]

#frontal area (m^2)
A=0.5

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

# Bycycle velocity (m/s)
v=20

Drag_force=[]
for C in C_d:
	Drag_force.append(0.5*C*A*d*pow(v,2))

print('values of Dragforce')
print(Drag_force)

plt.plot(C_d,Drag_force)
plt.xlabel('Drag Co-efficient')	
plt.ylabel('Dragforce in Newton')
plt.title('Variation of Dragforce with Drag co-efficient')
plt.show()

Explanation of code:-- Here array / list for drag coefficient (C_d) is declared having 25 elements. Drag coeffieients of differents shape of solid object having same frontal area are taken in to calculation of dragforce. An empty array of Drag_force is declared. A 'for loop' is used to calculate the dragforce for each element of the array/list of drag coefficient(C_d) & the calculated values of dragforce are put in to the array/list of Drag_force by 'append' command. The values of dragforce are printed & Dragforce is plotted w.r.t drag coefficient.

Result:-- Screenshots of result are given below.

Discussion on result:-- 1st screenshot shows the values of Dragforces for different values (25 no. of values) of drag coefficient along with code in sublime test editor.

2nd screen shot shows the plot of Dragforce vs drag coefficient. Here we can see that the graph is a straight line passing through origine ( in the form Y=mX) which means the dragforce varries with the drag coefficient linearly. From the equation of dragforce, we get F = k.C_d where constant k=0.5*A*d*v^2 as A, d, v are constant & k is the gradient of the straight line.

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.