Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/examples/bungee2.ipynb
Views: 531
Bungee Dunk Revisited
Modeling and Simulation in Python
Copyright 2021 Allen Downey
License: Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International
In the previous case study, we simulated a bungee jump with a model that took into account gravity, air resistance, and the spring force of the bungee cord, but we ignored the weight of the cord.
It is tempting to say that the weight of the cord doesn't matter because it falls along with the jumper. But that intuition is incorrect, as explained by Heck, Uylings, and Kędzierska. As the cord falls, it transfers energy to the jumper. They derive a differential equation that relates the acceleration of the jumper to position and velocity:
where is the net acceleration of the jumper, is acceleration due to gravity, is the velocity of the jumper, is the position of the jumper relative to the starting point (usually negative), is the length of the cord, and is the mass ratio of the cord and jumper.
If you don't believe this model is correct, this video might convince you.
Following the previous case study, we'll model the jump with the following assumptions:
Initially the bungee cord hangs from a crane with the attachment point 80 m above a cup of tea.
Until the cord is fully extended, it applies a force to the jumper as explained above.
After the cord is fully extended, it obeys Hooke's Law; that is, it applies a force to the jumper proportional to the extension of the cord beyond its resting length.
The jumper is subject to drag force proportional to the square of their velocity, in the opposite of their direction of motion.
First I'll create a Param
object to contain the quantities we'll need:
Let's assume that the jumper's mass is 75 kg and the cord's mass is also 75 kg, so
mu=1
.The jumpers's frontal area is 1 square meter, and terminal velocity is 60 m/s. I'll use these values to back out the coefficient of drag.
The length of the bungee cord is
L = 25 m
.The spring constant of the cord is
k = 40 N / m
when the cord is stretched, and 0 when it's compressed.
I adopt the coordinate system and most of the variable names from Heck, Uylings, and Kędzierska.
Now here's a version of make_system
that takes a Params
object as a parameter.
make_system
uses the given value of v_term
to compute the drag coefficient C_d
.
It also computes mu
and the initial State
object.
Let's make a System
drag_force
computes drag as a function of velocity:
Here's drag force at 20 m/s.
The following function computes the acceleration of the jumper due to tension in the cord.
Here's acceleration due to tension in the cord if we're going 20 m/s after falling 20 m.
Now here's the slope function:
As always, let's test the slope function with the initial params.
We'll need an event function to stop the simulation when we get to the end of the cord.
We can test it with the initial conditions.
And then run the simulation.
Here's the plot of position as a function of time.
We can use min
to find the lowest point:
As expected, Phase 1 ends when the jumper reaches an altitude of 55 m.
Phase 2
Once the jumper has falled more than the length of the cord, acceleration due to energy transfer from the cord stops abruptly. As the cord stretches, it starts to exert a spring force. So let's simulate this second phase.
spring_force
computes the force of the cord on the jumper:
The spring force is 0 until the cord is fully extended. When it is extended 1 m, the spring force is 40 N.
The slope function for Phase 2 includes the spring force, and drops the acceleration due to the cord.
The initial state for Phase 2 is the final state from Phase 1.
And that gives me the starting conditions for Phase 2.
Here's how we run Phase 2, setting the direction of the event function so it doesn't stop the simulation immediately.
We can plot the results on the same axes.
And get the lowest position from Phase 2.
To see how big the effect of the cord is, I'll collect the previous code in a function.
Now we can run both phases and get the results in a single TimeFrame
.
The difference is about a meter, which could certainly be the difference between a successful bungee dunk and a bad day.