Drag Force Evaluation Using Python
In this work, a Python program had to write to calculate the drag force against a cyclist. The drag force is an opposing force or the resistance to any object moving with respect to a surrounding fluid. It depends on the number of parameters such as density of air, the velocity of the body, the frontal area of the body, and the dimensionless quantity, called drag coefficient. The relation between these quantities is shown in the equation below.
Drag, Force, F = 0.5 x Density of Air x Frontal Area x (Velocity of Body)^2 x Drag Coefficient
Thus, the drag force is proportional to the square of the velocity. Also, for the same frontal area with different dimensions, the drag coefficient can vary. In this work, a Python program was scripted to calculate the drag force for varying velocities and the varying drag coefficients. The objectives of this work are given below.
OBJECTIVE
- To write a program to plot velocity vs. drag force.
- To write a program to plot drag coefficient vs. drag force.
PYTHON SCRIPT
1. To plot Velocity vs. Drag Force.
#Calculation for the Drag Force with varying Velocity
import math
import matplotlib.pyplot as pyplot
#Inputs
#Drag Coefficient
Cd = 0.8
#Density of Air
rho = 1.2
#Frontal Area
A = 1.8
#Velocity of the Body
Velocity = [8, 9, 10, 11, 12, 13, 14]
Drag_Force = []
for i in Velocity:
Drag_Force.append((0.5*rho*A*pow(i,2)*Cd))
print(Drag_Force)
pyplot.plot(Velocity,Drag_Force)
pyplot.xlabel('Velocity')
pyplot.ylabel('Drag_Force')
pyplot.show()
This code plots the relationship between the drag force and the varying velocity. In this program, the velocity was increasing linearly. But, because the drag force is proportional to the square of the velocity, the relation is parabolic.
2. To plot Drag Coefficient vs. Drag Force.
#Calculation for the Drag Force with varying Velocity
import math
import matplotlib.pyplot as pyplot
#Inputs
#Drag Coefficient
Cd = [0.47, 0.42, 0.5, 1.05, 0.8, 0.82, 1.15]
#Density of Air
rho = 1.2
#Frontal Area
A = 1.8
#Velocity of the Body
V = 5
Drag_Force = []
for i in Cd:
Drag_Force.append((0.5*rho*A*pow(V,2)*i))
print(Drag_Force)
pyplot.plot(Cd,Drag_Force)
pyplot.tick_params(axis='x', rotation=45)
pyplot.xlabel('Drag_Coefficient')
pyplot.ylabel('Drag_Force')
pyplot.show()
CONCLUSION
This code plots the relationship between the drag force and the drag coefficient. In this program, different values for drag coefficient were taken. Because the drag force and the drag coefficient are directly proportional, and the drag coefficient is varying almost linearly, the drag force also varies linearly.