Project

Flow over a Bicycle using PYTHON

FLOW OVER A BICYCLE

For a cyclist, when cycling there affects a several factors which decides the velocity and Potential Energy consumed for a cyclist. The Aerodynamic study shows that apart from the thrust force of the cyclist, there exists a opposing force called as DRAG FORCE which is basically nothing but the resistance offered by the wind over the cycle and cyclist. Other factors include Ground Reaction, Acceleration due to Gravity, Side Winds, Bending Angle of Cyclist etc..

In this particular case study, Let us consider

  • The Drag Force exerted on the cyclist due to wind resistance from the opposite side. (`Fd`) in N.
  • The Velocity of the cycle. (v) in m/s^2.
  • The Drag Coefficient with different positions of cyclist. (Cd) unitless.
  • The Frontal Area subjected to wind resistance. (A) in m^2.
  • The density of the medium ie; Air/wind (`rho`) in Kg/m^3

The equation for the Drag Force is given by,

{1}

fig(1)

1. Program to Plot Velocity v/s Drag Force

# Program to Calculate the Drag Force

import matplotlib.pyplot as plt

#Inputs

#Drag Coefficient
c_d=1.05

#Frontal Area (m^2)
A=2.1

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

#Velocity(m/s^2)
velocities=[1,2,3,4,5,6,7,8,9,10]

drag_forces=[]

for velocity in velocities:
	drag_forces.append(0.5*c_d*rho*A*velocity*velocity)  #Drag Force (N)

print(drag_forces)

plt.plot(velocities,drag_forces)
plt.xlabel('Velocity (m/s^2)')
plt.ylabel('Drag Force (N)')
plt.show()

CODE EXPLANATION:

Anything which begins with # is an comment section.

Before we start a program all the necessary modules are being imported, here in this case to plot matplotlib.pyplot is imported.

#inputs

The Drag coefficient is considered to be c_d=1.05, since the fluid medium here is Wind**.

The frontal Area is taken on general basis considering the Persons body and Bicycle parts which faces the Wind A=2.1m^2.

The Density of Air is considered as rho=1.2 Kg/m^3

Let the velocity of the Bicycle may vary from 1m/s to 10m/s (upto speed of 36 Kmph)

Since Velocity of bicycle varies, we have considered it as an array velocities.

Intially an Empty Array [] is called out to store the values of drag_forces in later stages.

A for loop has been called to calculate the value for drag_force at each velocity & .append is used to store the calculated value in the drag_forces array.

The formula for Drag Force is entered as given in equation 1.

print comand is used to print the value of drag_forces in comand window.

Plotting of the Velocity against the Drag Force is done study the behaviour using plt.plot comand

Labelling of the axes is dine through plt.xlabel & plt.ylabel comands

plt.show helps to display the plot.

Results :

2. Program to Plot Drag Coefficient v/s Drag Force for various shapes:

"""
To study the behaviour of drag force for different shapes
c_d values for
sphere,halfsphere,cone,cube,angled_cube,long_cylinder
short_cylinder,streamlined_body,half_streamline
"""
import matplotlib.pyplot as plt
import math

s=0.47
hs=0.42
cn=0.5
cu=1.05
ac=0.80
lc=0.82
sc=1.15
sl=0.04
hsl=0.09

c_d=[s,hs,cn,cu,ac,lc,sc,sl,hsl]

c_d.sort()

# Area (m^2)
A=1.5

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

# Velocity (m/s^2)
v=25

# Drag force (N)
drag_forces=[]

for drag_coeff in c_d:
		drag_forces.append(0.5*drag_coeff*rho*A*v*v)  #Drag Force (N)

print(drag_forces)

plt.figure(2)
plt.plot(c_d,drag_forces)
plt.xlabel('Drag Coefficient')
plt.ylabel('Drag Force [N]')
plt.show()

Code Explanation :

Anything which is enclosed within """.....""" is an comment Section.

Before we start a program all the necessary modules are being imported, here in this case to plot matplotlib.pyplot is imported.

The value for the Drag Coefficients for different shapes in program are referred online,

These values are arranged into an matrix by caling out an Array by name c_d, the same array is sorted using sort() comand.

The formula remains same as in 1st case.

An empty array is called out to store the values of drag forces by append comand for different drag corfficients.

Drag forces are printed using print comand

Plotting and labelling are done by using plt.plot, plt.xlabel, plt.ylabel, plt.show().

Result :

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.