Project

Flow Over Bicycle Python

Program to Calculate the Drag Force acting on a Cyclist

Description: In this code we calculate the Drag Force that Acts against a Cyclist, inorder to do that, we use the formula as given below:

Fd = (0.5*Rho*A*Cd.*V.^2)

where:
Fd = Drag Force in Newton
Rho = Density of Air in Kg/m^3
A = Area occupied by the object against the airflow in m^2
Cd = Coefficient of Drag, its a non-dimensionl quantity
V = Velocity at which the object is moving

Once we define the formula, we then plot a graph of Drag Force VS Velocity and
Drag force vs Drag Coefficient

The Code to define the problem is as given below:

\"\"\"
Created on Sat Jun 16 10:10:55 2018

@author: shabarish
\"\"\"
                #Program to Calculate Drag Force on a Cyclist#
import matplotlib.pyplot as plt #We import the Matplot library module to make plots#
import numpy as np
                #Define the Inputs#
Cd = np.linspace(0.1,0.8,8)     #Drag Coefficient (Non Dimensional Quantity)#
A = np.linspace(0.5,1.2,8)      #Area in m^2#
Rho = 1.2                       #Density in kg/m^3#
v = np.linspace(5,12,8)         #velocity in m/s#
drag_force = []                 #Drag force in Kg/ms^-2, we create an empty array so that later we can store new values#
for values in v:
    print(values)
    drag_force = (0.5*Rho*A*Cd*v*v)
    print(drag_force)
#Plotting#
plt.plot(v,drag_force, \'r\')
plt.xlabel(\'Velocity [m/s]\')
plt.ylabel(\'Drag force [Kg/ms^-2]\')
plt.show()
plt.plot(drag_force,Cd,\'g\')
plt.xlabel(\'Drag force [Kg/ms^-2]\')
plt.ylabel(\'Drag Coefficient Cd\')
plt.show()

Results:

Figure 1 : Drag Vs Velocity Graph

Figure 2: Drag Force Vs DragCoefficient

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.