Simulating Projectile Motion with Air Resistance
Introduction
In this project I will show how projectile motion can be modelled with and without air resistance. Projectiles experience drag from the air which is dependent on the objects velocity, shape, size and the density of the air. Without accounting for air resistance the projectile’s motion can be calculated analytically becuase the acceleration due to gravity is constant. However, when air resistance is accounted for, the drag force dependents on the velocity, causing the drag force to change during it’s flight. This produces differential equations which can be evaluated far easier use numerical methods such as the one I will use Euler’s method.
Projectile motion without air resistance
Let the initial velocity of a projectile be 30m/s and its launch angle 45 degrees. The only force acting on the projectile is gravity as we are disregarding air resistance, therefore we can split our velocity into its x and y components by:
Now that we have the and velocities we can create a function that gives us our y value for every x value as the x velocity experiences no acceleration due to gravity. But for the y velocity we need to account of gravity which we will take to be . To do this we can use the SUVAT equation
we can the substitute as the projectile will fall due to the force of gravity. Giving
Therefore
This gives us a function of y given time but we want a function such that y(x) so we can substitute t for this gives use the final equation:
and the trig identity
import math
import matplotlib.pyplot as plt
G = 9.81
U = 30
theta = math.radians(45)
time = 0.01
x = 0
y = 0
x_plot= [0]
y_plot = [0]
dx = 0.01
x = 0
while y >= 0:
y = (math.tan(theta) * x) - (
G * x**2 / (2 * U**2 * math.cos(theta)**2)
)
x_plot.append(x)
y_plot.append(y)
x += dx
plt.plot(x_plot, y_plot)
plt.title("U = 30 m/s, θ = 45°")
plt.xlabel('Distance [m]')
plt.ylabel('Distance [m]')
plt.show()This gives the result of:
Modeling air resistance
Note
My implementation of drag will only work for subsonic speeds, as the force of drag drastically changes for supersonic speeds.
This is where modelling the trajectory becomes more difficult as the equations become more complex as it results in no simple analytical solution instead a differential equation. Therefore I will use Euler’s method of numerical approximation to evaluate the drag equations. In the last section the model does not interact with the atmosphere. However in reality this is not true as the projectile will interact with particles in the air, this in turn produces a force called drag which will oppose its motion.
For objects traveling through the air at subsonic speeds, drag can be approximated using the quadratic drag equation:
Where:
- = Air Density
- = Drag Coefficient
- = Cross Sectional Area
- = Its speed
For this simulation I use:
This is because these values represent a ball of mass 1kg and air density at sea level. with a density of this would be a solid ball of PVC with a diameter of about 10cm.
The drag force is proportional to , meaning that it increases rapidly with speed. This is why drag becomes increasingly important at high speeds and must be accounted for in the design of high-speed aircraft, such as the Convair 990, one of the fastest subsonic airliners ever built.
For example doubling the speed increases the drag force by a factor of 4:
Using the drag force as a vector
Force is a vector this means that it has a direction in the case of drag it always acts in the opposite direction to motion.
The velocity has two components and therefore the total speed is
Since drag acts in the opposite direction to motion the drag vector is:
Therefore, the horizontal component of drag is:
and the vertical component is:
Converting force into acceleration
We can use newtons second law and rearrange it for acceleration:
So the final equation we get for the horizontal acceleration is:
For the vertical acceleration we need to account for both forces acting on the projectile:
- Gravity
- Air Resistance
Gravity produces:
Air Resistance produces:
therefore the total vertical force is:
Taking newtons second law into account we can divide by mass:
Why numerical methods are needed
Without air resistance, the equations of motion can be solved analytically to obtain a simple function to describe the projectiles trajectory.
With quadratic air resistance the acceleration depends on the velocity which is continuously changing. This could be solved using differential equations. Instead I will use numerical methods to approximate the result. The method in this project uses Euler’s method.
Euler’s method
Important
The smaller the value the more accurate the approximation is although this requires more calculations.
Euler’s method uses small steps to approximate continuous processes.
I use:
Calculate current speed:
It then uses the drag equations to calculate the acceleration
The position will then be updated:
This process is repeated until the object hits the ground
import math
import matplotlib.pyplot as plt
# Constants
v0 = 30
theta = math.radians(45)
m = 1
A = 0.01
drag = 0.47
air_density = 1.225
G = 9.81
dt = 0.01
# Initial conditions
x = 0
y = 0
vx = math.cos(theta) * v0
vy = math.sin(theta) * v0
x_plot = [x]
y_plot = [y]
# Numerical simulation with air resistance
while y >= 0:
v = math.sqrt(vx**2 + vy**2)
ax = -((air_density * drag * A) / (2 * m)) * v * vx
ay = -G - ((air_density * drag * A) / (2 * m)) * v * vy
vx += ax * dt
vy += ay * dt
x += vx * dt
y += vy * dt
x_plot.append(x)
y_plot.append(y)
plt.plot(x_plot, y_plot)
plt.title("U = 30 m/s, θ = 45°")
plt.xlabel('Distance [m]')
plt.ylabel('Distance [m]')
plt.show()This gives the new trajectory:
This shows that the maximum height achieved will be lower that without air resistance and the total distance traveled is less that without air resistance.
Comparison
To verify the simulation, I also calculated the theoretical trajectory without air resistance.
This gives two different models of the same initial projectile:
- A numerical model including air resistance
- An analytical model without air resistance
With both models in comparison the effect of drag is immediately visible.
Conclusion
Drag plays a significant role in determining the trajectory of a projectile, resulting in an 11% reduction in its range in this case.