Write a Python program to calculate drag force against a cyclist
Objective
Write a Python program to calculate drag force against a cyclist
Problem Statement
- Write a program to plot Velocity vs Drag force.(25 points)
- Write a program to plot Drag Co-efficient vs Drag force.(25 points)
Theory
Drag Force:A drag force is the resistance force caused by the motion of a body through a fluid, such as water or air. A drag force acts opposite to the direction of the oncoming flow velocity. This is the relative velocity between the body and the fluid.
Code
import math
import matplotlib.pyplot as plt
import numpy as np
drag_coffs=np.linspace(0,2,25)
#frontal area(m^2)
A=0.1
#density(kg/m^3)
rho=1.2
velocities=[0,25]
drag_force=[]
drag_force_cd=[]
for velocity in velocities:
drag_force.append(0.5*drag_coffs*rho*A*velocity*velocity
print(drag_force)
plt.plot(velocities,drag_force)
plt.xlabel('velocity')
plt.ylabel('drag force')
plt.show()
Results
velocities vs drag_force plot
drag_coffs vs drag_force_cd plot