FLOW OVER BICYCLE USING PYTHON
AIM
To calculate the drag force against a cyclist using Python.
OBJECTIVES
To plot the following graphs using Python.
- Velocity vs Drag Force
- Drag Force vs Drag Coefficient
THEORY
DRAG FORCE
A drag force is a 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. The following is the formula to calculate the drag force.
`F_d = 1/2 * ρ * A * V^2 * C_d`
where
`F_d` Drag force `N`
`A` Frontal area `m2`
`V` Velocity `m⁄s`
`ρ` Density of fluid `kg⁄m3`
`C_d` Co-efficient of drag
DRAG COEFFICIENT
Drag coefficient is a dimensionless quantity which is used to quantify the drag or resistance of an object in a fluid environment such as water or air. It is used in drag equation in which the lower the drag coefficient indicates less aerodynamic drag.
VELOCITY vs DRAG FORCE
The following are the conditions considered in order to find the relationship between velocity and drag force.
The density of air is `1.204 kg⁄m3`
The frontal area of the bicycle is `0.46 m2` in sprint regular position.
The drag co-efficient is 0.67
The velocity of the bicycle is varied from `1 m⁄s` to `10 m⁄s`
The following is the code to perform the necessary operation.
# Program to calculate the drag force of bicycle
import math # To import math library to perform mathematical operation
import matplotlib.pyplot as plt # This library is imported to generate plots.
import numpy as np # This library is used for working with arrays
rho = 1.204 # The density of the fluid in Kg/m^3
a = 0.46 # Frontal area in m^2
c_d = 0.67 # Drag coefficent
v = np.linspace(1,10,10) # The velocity of the bicycle is varied between 1 m/s to 10 m/s with the help of linspace command.
print(v) # The values of velocities are printed
drag_force = 0.5*v*v*rho*a*c_d # Formula to calculate drag force
print(drag_force) # The values of drag forces are printed
plt.figure('Velocity vs Drag Force') # Used to give the title for the plot
plt.plot(v,drag_force) # Generates a plot between Velocity and Drag force
plt.xlabel('Velocity in m/s') # To label x axis
plt.ylabel('Drag Force in N') # To label y axis
plt.show() # To show the graph
plt.savefig('Plot 1') # To save the figure
The Velocity vs Drag Force plot is shown below
PLOT 1
OUTPUT WINDOW
DRAG FORCE vs DRAG COEFFICENT
The following are the conditions considered in order to find the relationship between drag force and drag coefficient.
The drag coefficient for various positions of drag forces are as follows
|
POSITION |
DRAG COEFFICIENT |
|
Sprint regular |
0.670 |
|
Sprint low |
0.626 |
|
Back up |
0.655 |
|
Back horizontal |
0.638 |
|
Back down |
0.655 |
The velocity of the bicycle is `11 m/s`
The density of air is `1.204 kg⁄m3`
The frontal area of the bicycle is 0.46 `m2`
The following is the code to perform the necessary operation.
# To determine the relationship between drag coefficient and velocity
import math # To import math library to perform mathematical operati
import matplotlib.pyplot as plt # This library is imported to generate plots
import numpy as np # This library is imported to work with arrays
rho = 1.204 # Density of the fluid in kg/m^3
v = 11 # Velocity in m/s
a = 0.46 # Frontal area in m^2
c_d =np.array([0.670,0.626,0.655,0.638,0.655]) # The values of drag coefficient under different conditions
drag_force = (0.5*v*v*a*rho*c_d) # Formula to calculate drag force
print(drag_force) # Prints the value of drag force
plt.figure('Drag Force vs Drag Coefficient') # Title for the plot
plt.plot(c_d,drag_force) # Generates a plot between Drag force and Drag coefficient
plt.xlabel('Drag Coefficient') # To label x axis
plt.ylabel('Drag Force in N') # To label y axix
plt.show() # To show the plot generated
plt.savefig('plot 2') # To save the plot
The Drag coefficient vs Drag force plot is shown below.
OUTPUT WINDOW
RESULTS
The drag force against a bicycle is calculated and the graphs have been plotted.
From PLOT 1, it is clear that the drag force is directly proportional to the square of the velocity and from PLOT 2, it is clear that the drag force varies linearly with respect to drag coefficient.
REFERENCE