Project

Drag Force and its variation with Velocity and Cd using python.

Aim- Drag Force: and its variation with Velocity and Cd.

Objective-

Write a Python program to calculate drag force against a cyclist.

The factors involved are Velocity, Drag coefficient, Frontal Area, Density of air.

Write a program to plot Velocity vs Drag force. (25 points)

Write a program to plot Drag Co-efficient vs Drag force. (25 points)

Drag Force-

Another interesting force in everyday life is the force of drag on an object when it is moving in a fluid (either a gas or a liquid). You feel the drag force when you move your hand through the water. You might also feel it if you move your hand during a strong wind. The faster you move your hand, the harder it is to move. You feel a smaller drag force when you tilt your hand so only the side goes through the air—you have decreased the area of your hand that faces the direction of motion. Like friction, the drag force always opposes the motion of an object. Unlike simple friction, the drag force is proportional to some function of the velocity of the object in that fluid. This functionality is complicated and depends upon the shape of the object, its size, its velocity, and the fluid it is in. For most large objects such as bicyclists, cars, and baseballs not moving too slowly, the magnitude of the drag force FD is found to be proportional to the square of the speed of the object. We can write this relationship mathematically as:

code-

Velocity v/s Drag force-

import matplotlib.pyplot as plt
import math
def drag(v,cd,a):
	#v=velocity
	#cd=drag co-efficient
	#a=frontal area
	#density=1.2 kg/m^3
	d=1.2
	#drag=1/2*v^2*cd*d*
	dragforce=0.5*d*a*cd*math.pow(v,2)
	return dragforce;

#initial values
#varray
v=[]
for a in range (0,100,4):
	v.append(a)

print(len(v))
cd=.8
a=.1
df=[]
for vel in v:
	#calling function drag
	df.append(drag(vel,cd,a))

#plotting
plt.plot()
plt.plot(v,df)
plt.xlabel('Velocity(m/s)')
plt.ylabel('Drag Force(N)')
plt.show()

Output-

Code-

Drag force v/s C_d-

import matplotlib.pyplot as plt
import math
import numpy as np

def drag(v,cd,a):
	#v=velocity
	#cd=drag co-efficient
	#a=frontal area
	#density=1.2 kg/m^3
	d=1.2
	#drag=1/2*v^2*cd*d*
	dragforce=0.5*d*a*cd*math.pow(v,2)
	return dragforce;

#initial values
#varray
cd=np.linspace(0.01,1.5,25)
print(len(cd))
a=.1
df=[]
vel=1
for c in cd:
	#calling function drag
	df.append(drag(vel,c,a))

#plotting
plt.plot()
plt.plot(cd,df)
plt.xlabel('Cd')
plt.ylabel('Drag Force(N)')
plt.show()

Output-

Conclusion-

Like friction, the drag force always opposes the motion of an object. Unlike simple friction, the drag force is proportional to some function of the velocity of the object in that fluid. This functionality is complicated and depends upon the shape of the object, its size, its velocity, and the fluid it is in. For most large objects such as bicyclists, cars, and baseballs not moving too slowly, the magnitude of the drag force FD is found to be proportional to the square of the speed of the object.

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.