You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: posts/projectileMotion/projectileMotionWithDrag.qmd
+65-39Lines changed: 65 additions & 39 deletions
Original file line number
Diff line number
Diff line change
@@ -13,12 +13,19 @@ execute:
13
13
messages: false
14
14
warning: false
15
15
jupyter: python3
16
-
draft: true
17
16
---
18
17
19
-
I've stalled out a bit on my heat equation modeling project because I've been thinking about ways to make it better. Also, I've been busy with the real world. So I thought I'd adapt something that I've used in class and post it here. In the standard treatment, we often make approximations that may or may not be valid, and never test these approximations. In fact, that's why we physicists often get made fun of, because we are talking about spherical cows. I like to get my students to think beyond spherical cows and give them tools to examine the limits of these approximations.
I've stalled out a bit on my heat equation modeling project because I've been thinking about ways to make it better. Also, I've been busy with the real world. So I thought I'd adapt something that I've used in class and post it here. Plus, I can't let my students have *_all_* the fun, right? In the standard treatment, we often make approximations that may or may not be valid, and never test these approximations. In fact, that's why we physicists often get made fun of, because we are talking about spherical cows. I like to get my students to think beyond spherical cows and give them tools to examine the limits of these approximations. So I'm going to build the models, and then play around a bit.
I've given this problem (or variations of it) in my physics class for years:
@@ -276,7 +283,7 @@ class dragProjectile:
276
283
## Comparing motion with/without air resistance
277
284
Now that we have these tools built, we can start to visualize this motion. I'll do this using some functions in my `projectile.py` file to make graphs. I will also include the following numerical values:
278
285
279
-
- $H = 100$ m
286
+
- $H = 200$ m
280
287
- $v_i = 100$ m/s
281
288
- $\theta = 30$ deg
282
289
- $m = 1$ kg
@@ -287,7 +294,7 @@ import numpy as np
287
294
import matplotlib.pyplot as plt
288
295
from projectile import *
289
296
290
-
H = 100
297
+
H = 200
291
298
vi = 100
292
299
theta = 30
293
300
m = 1
@@ -303,7 +310,7 @@ I will visualize this motion in two ways. First, I'll plot each quantity of the
303
310
plotCannonCurves(vi,theta,H,m,c)
304
311
```
305
312
306
-
Now I will plot the trajectory (y-coordinate vs x-coordinate).
313
+
Now I will plot the trajectory (y-coordinate vs x-coordinate). Note that I have added boxes to this plot indicating the cliff location and the water level to help guide the eye. The plot has also been set up with an equal aspect ratio so that the horizontal and vertical distances are the same. The green curve should more closely match the golf ball tracer than the red parabolic path does.
307
314
308
315
```{python}
309
316
#| fig-align: "center"
@@ -312,19 +319,21 @@ Now I will plot the trajectory (y-coordinate vs x-coordinate).
312
319
makeTrajectoryPlot(vi,theta,H,m,c)
313
320
```
314
321
315
-
### When should we consider air resistance?
316
-
Since we are usually most concerned with where the projectilewill land (have to hit the pirates storming the fort...) let's design a metric for quantifying the difference between the models with/without air resistance. Since I used $D$ to denote the range, I will write $D_1$ to denote the range for model 1 (no air resistance) and $D_2$ to denote the range for model 2 (with air resistance). Therefore the quantity below is the fractional difference between the targeting location of the models.
322
+
### Where to go from here
323
+
Usually, I'll give my students some tasks like finding the maximum range of the projectile, and comparing the model results. I thought that I would do something a little different as it will allow me to compare the model predictions. I will do this using the fractional difference between the two predictions for both the range and the time of flight. Since I used $D$ to denote the range, I will write $D_1$ to denote the range for model 1 (no air resistance) and $D_2$ to denote the range for model 2 (with air resistance). Therefore the quantity below is the fractional difference between the targeting location of the models.
317
324
318
325
$$
319
326
\delta_D = \frac{\left|D_1 - D_2\right|}{D_1}
320
327
$$
321
328
322
-
I would also like to calculate a similar quantity related to the time-of-flight
329
+
I will also define a similar quantity related to the time-of-flight.
323
330
324
331
$$
325
-
\delta_T = \frac{\left|T_1 - T_2\right|}{T_1}
332
+
\delta_T = \frac{\left|T_2 - T_1\right|}{T_2}
326
333
$$
327
334
335
+
Note that I'm using $D_1$ in the denominator of $\delta_D$ and $T_2$ in the denominator of $\delta_T$. This is because these are the larger values for each motion.
336
+
328
337
I will calculate these quantities for a range of launch velocities, masses, and launch angles keeping the cliff height $(H=100 \,\text{m})$ and drag coefficient $(c=0.003 \,\text{kg/m})$ the same as it was before.
329
338
330
339
```{python}
@@ -333,9 +342,9 @@ I will calculate these quantities for a range of launch velocities, masses, and
333
342
import matplotlib.colors as mc
334
343
import matplotlib.cm as cm
335
344
336
-
launchVelocities = np.linspace(0,1000,20)
337
-
launchAngles = np.arange(0,89,5)
338
-
masses = np.linspace(0.1,100,20)
345
+
launchVelocities = np.linspace(0,200,21)
346
+
launchAngles = np.linspace(0,85,18)
347
+
masses = np.logspace(-2,2,19)
339
348
nv = len(launchVelocities)
340
349
na = len(launchAngles)
341
350
nm = len(masses)
@@ -353,7 +362,7 @@ for i in range(nv):
353
362
D2 = m2.maxX
354
363
T1 = m1.tof
355
364
T2 = m2.tof
356
-
deltaT[i,j,k] = np.abs(T1 - T2)/T1
365
+
deltaT[i,j,k] = np.abs(T1 - T2)/T2
357
366
if D1<1 and D2 <1:
358
367
# For small ranges (less than 1 meter from the cliff), just set the
359
368
# fractional difference equal to zero
@@ -362,8 +371,10 @@ for i in range(nv):
362
371
deltaD[i,j,k] = np.abs(D1 - D2)/D1
363
372
364
373
# Set up properties of the color bar
365
-
cnorm = mc.Normalize(vmin=0,vmax=1)
366
-
cbar = cm.ScalarMappable(norm=cnorm)
374
+
cnormD = mc.Normalize(vmin=0,vmax=deltaD.max())
375
+
cbarD = cm.ScalarMappable(norm=cnormD)
376
+
cnormT = mc.Normalize(vmin=0,vmax=deltaT.max())
377
+
cbarT = cm.ScalarMappable(norm=cnormT)
367
378
368
379
# Arrange the calculations into multiple grids for making a heatmap/contour plot
Areas where the color is yellow shows a high level of disagreement between motion in vacuum vs. motion in air. Areas where the color is blue/violet shows a low level of disagreement between the models. Since air resistance is dependent on speed, we would expect that at low speeds, air resistance is less important. And this is what we see in these plots--note the deep blue color in the first 2 panels along the y axis (where the launch velocity is small). This should make sense. Also we note that with large masses, air resistance is less important as well.
413
-
414
-
Finally, examine the Time of Flight:
415
426
427
+
Finally, I'll examine the model agreement for the time-of-flight:
416
428
```{python}
417
429
#| code-fold: true
418
430
#| fig-align: "center"
419
431
#| width: 90%
420
432
421
-
fig2, ax2 = plt.subplots(1,3,figsize=(7,4))
422
-
fig2.suptitle("Comparing predicted TOF with/without air resistance")
Note that the color scales for these plots have different ranges. In particular the max $\delta_T$ value is larger than the max $\delta_D$ value. Given the initial height, it would seem that the time of flight is much more sensitive to air resistance. In general, areas on the plots above where the color is yellow shows a high level of disagreement between motion in vacuum vs. motion in air. Areas where the color is blue/violet shows a low level of disagreement between the models. Since air resistance is dependent on speed, we would expect that at low speeds, air resistance is less important. Given the fact that gravity/weight is the other force of interest, objects with a larger mass are also less sensitive to air resistance.
460
+
461
+
There is an interesting "trough" in the time of flight graphic. You can see that the minimum $\delta_T$ values aren't along one of the axes as they are for $\delta_T$. This is because for very slow, or nearly vertical launch trajectories, the range isn't going to be very different as it just doesn't move very fast in the x-direction. But the time is quite different, and you can start to see the reason for this when you look at the $v_y$ vs $t$ graph. For the graphs below, you can see that the projectile turns around $(v_y=0)$ sooner when air resistance is considered. It's fun to think about and play around with.
0 commit comments