Project

FLOW OVER BICYCLE WITH PYTHON

Aim

Write a python program: Flow over the bicycle

Objective

  1. Calculate Drag Force
  2. Plot Curve of Drag Coefficients Vs Velocity
  3. Plot Curve of Drag Force Vs Drag Coefficients

Theory

In the case of a bicycle Problem, there are mainly involved five types of forces.

  1. Applied force
  2. Gravity
  3. Normal Force
  4. Friction
  5. Air Resistance

Here in our case, we are calculating the values of Drag Force Against Cyclist, the factors involved are velocity, Drag Coefficients, frontal area, the density of air. Drag is a mechanical force that objects feel when they move through a fluid (liquid or gas). Like kinetic friction, the drag force is reactive because it only exists when the object is moving, and it points in the opposite direction to the object's motion through the fluid. In General, drag is generated by the difference in velocity between solid object and fluid.

Python Code

'''
program to calculate drag force against Cyclist
program to plot Velocity Vs Drag Force
program to plot Drag Force Vs Drag Co-efficients
by SLOMO THOMAS 
'''
# Modules imported in the code 
import matplotlib.pyplot as plt
import numpy as np
import math
import scipy

#inputs

#drag coefficient
c_d=0.8   
drag_coeffs=[0.3,0.4,0.5,0.6,0.7,0.8,0.9]
drag_forces_cd=[]

#frontal area(m^2)
A=0.1    

#density(kg/m^3)
rho=1.4
   
#velocity
velocities=[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))

print(drag_forces)
plt.plot(velocities,drag_forces)
plt.xlabel('velocity')
plt.ylabel('dragforce')
plt.show()

for drag_coeff in drag_coeffs:
	drag_forces_cd.append(0.5*drag_coeff*rho*A*velocity*velocity)

print(drag_forces_cd)
plt.plot(drag_coeffs,drag_forces_cd)
plt.xlabel('drag coefficient')
plt.ylabel('drag force')
plt.show()

Explanation of the code

  • Imported modules in python such as numpy,scipy,mathplotlib,math
  • inputs are assigned such as the value of the frontal area, density, drag coefficients, velocity
  • velocity and drag coefficients are defined as arrays, by using for loop and appending we calculate the value of drag force corresponding to it.
  • plotting of drag force against velocity and drag coefficient as two different plot by using plotting command and labeled
  • finally, the plot is shown by plt.show()

Results

  • Variable Explorer

Plots Obtained

  • Drag Coefficient Vs Drag Force

  • Drag Force Vs Velocity

Conclusion

  • The drag force is calculated
  • plots are obtained

Reference

  • Google Images
  • Wikipedia
  • Quora
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.