Calculating Drag Force Using Python
Aim :- To write a Python program to calculate drag force against a cyclist.
Objectives :-
- To write a program to plot Velocity vs Drag force.
- To write a program to plot Drag Co-efficient vs Drag force.
Introduction :-
Drag force is a force acting opposite to the relative motion of any object moving with respect to a surrounding fluid.
Drag force can be found using formula,
Drag force = 0.5 x ρ x A x V2 x Cd
The unit of drag force is newton or kg.m/s2 .
Here,
A = Frontal area
V = Velocity
Cd = Drag coefficient. It is unitless.
ρ = Density
Program :-
1. Program to plot velocity vs drag force.
#Program to plot velocity vs drag force
#Program by Saurabh Kshirsagar
import matplotlib.pyplot as plt
#Inputs
#Drag coefficient
c_d = 0.8
#Frontal area
A = 0.1
#Density
rho = 1.2
#Bicycle velocity
velocities = [8,9,10,11,12,13,14,15]
drag_forces = []
for velocity in velocities:
drag_forces.append((0.5*rho*A*velocity*velocity*c_d))
#Plotting
plt.plot(velocities,drag_forces)
plt.xlabel('Velocity')
plt.ylabel('Drag Force')
plt.show()
2. Program to plot Drag Co-efficient vs Drag force.
#Program to plot drag coefficient vs drag force
#Program by Saurabh Kshirsagar
import matplotlib.pyplot as plt
#Inputs
#Bicycle velocity
velocity = 10
#Frontal area
A = 0.1
#Density
rho = 1.2
#drag coefficient
drag_coefficients = [0.4,0.5,0.6,0.7,0.8]
drag_forces = []
for c_d in drag_coefficients:
drag_forces.append((0.5*rho*A*velocity*velocity*c_d))
#Plotting
plt.plot(drag_coefficients,drag_forces)
plt.xlabel('Drag coefficient')
plt.ylabel('Drag Force')
plt.show()
Output:-
1. Velocity vs Drag force
Here, we wrote a program to plot velocity vs drag force. The above image is the output of the program.
Assumptions made were,
Frontal area = 0.1 m2 .
Density = 1.2 Kg/m3 .
Coefficient of drag = 0.8
Velocity of bicycle = varying between 8 to 15 m/s
As we can see in the above graph, Velocity varies proportionaly with drag force. And as velocity increases drag force also increases.
2. Drag Co-efficient vs Drag force.
Here, we wrote a program to drag coefficient vs drag force. The above image is the output of the program.
Assumptions made were,
Frontal area = 0.1 m2 .
Density = 1.2 Kg/m3 .
Coefficient of drag = varying between 0.4 to 0.8. (sphere=0.47, cone=0.5, angles cube=0.8, etc)
Velocity of bicycle = 10 m/s
As we can see in the above graph, drag coefficient varies linearly with drag force. And as drag coefficient increases drag force also increases.
Conclusion:-
From the program we found the variation of drag force with velocity and drag coefficient respectively.