Python program to calculate drag force against a cyclist
Python program to calculate drag force against a cyclist
Drag force is function of frontal area (A), Density (rho), Drag coeffieient (c_d) and velocity (V)
Case-1: Velocity varies from 1 m/s to 25 m/s, A=0.1 m^2, rho= 1.2 Kg/m^3, c_d=0.8
Aim- To write a python code to study drag force with a change in factor velocity.
"""
A Program to calculate drag force
By Kailas K
"""
import matplotlib.pyplot as plt
# Inputs
# Drag coeff
c_d = 0.8
# frontal area
A = 0.1
# Density
rho = 1.2
# Bicycle velocity
velocities = []
for i in range (1,26):
velocities.append(i)
drag_force = []
for velocity in velocities:
drag_force.append((0.5*rho*A*c_d*velocity*velocity))
print(drag_force)
plt.plot(velocities,drag_force)
plt.xlabel ('velocity')
plt.ylabel ('drag_force')
plt.show()
Output
Conclusion-From above plot as velocity increases there is parabolic increase in drag force.
Case-2: Velocity 5 m/s, A=0.1 m^2, rho= 1.2 Kg/m^3, c_d varies from 0 to 1.5
Aim- To write a python code to study drag force with a change in factor drag coefficient.
"""
A Program to calculate drag force
By Kailas K
"""
import math
import matplotlib.pyplot as plt
# Inputs
# Drag coeff
c_ds = [0,0.1,0.15,0.2,0.25,0.3,0.35,0.4,0.45,0.5,0.55,0.6,0.65,0.7,0.75,0.8,0.85,0.9,0.95,1,1.05,1.2,1.25,1.3,1.35,1.4,1.45,1.5]
# frontal area
A = 0.1
# Density
rho = 1.2
# Bicycle velocity
velocity = 5
drag_force = []
for c_d in c_ds:
drag_force.append((0.5*rho*A*c_d*velocity*velocity))
print(drag_force)
plt.plot(c_ds,drag_force)
plt.xlabel ('c_d')
plt.ylabel ('drag_force')
plt.show()
Output
Conclusion- Drag force is directly proportional to drag coefficient