Now that you have played around a bit with your model, it might be nice to change how far the photon moves at each step. We can change how far the photon jumps by adding a multiplier in front of our \(sin\) and \(cos\) expressions. Create a variable called step_length
under your definition for Y_list
(outside of the loop). We will play around with it later, but for now set it equal to 1
.
step_length = 1
Now multiply the m.cos(angle)
and m.sin(angle)
expressions in the loop by our step_length
variable so they look something like:
X = X + step_length * m.cos(angle)
Y = Y + step_length * m.sin(angle)
Nice work! Now for our final addition, it might be nice to know how many steps it took our photon to escape. We can add a counter called N
to measure the number of steps by defining it to be \(0\) when we start our model and increasing it by \(1\) every time our model runs. On the line below our definition for step_length
, add:
N = 0
and right before we define our angle (the first line inside our loop), add:
N = N + 1
Now we have a counter that increases each time the model moves the photon! Make sure our final step count is returned by changing the final line of our model to read:
return(X_list,Y_list,N)
Run the cell that holds our model and head down to the viewing panel section. Change the line where we run our model to also save the total step count:
x,y,N = model(R)
And you've done it! We can now print the total step count or we can add it to the top of our figure by adding the line:
ax.set_title('Step Count:' + str(N))
at the end of the cell with our plotting code. You just created a fully functional physics simulation. Good job!
As you run your model, the photon takes a jittery path from the core of the star to its edge. Explain to your activity partner briefly in your own words why the photon takes this path instead of a straight one out of the star.
A photon moving out of the Sun with no resistance should escape the Sun in less than 5 seconds. Based on what you have seen by running your real physical model of a photon traveling through a star, estimate again how long you think it would take a photon making this "random walk" to escape? (Each of you should make your own estimate.)
It's worth noting two differences between your model and real life. First, we are assuming the radius of the star in our model is around 100cm. Of course that isn't a good estimate for the entire star, but it actually is a pretty good model of what is happening in a small sphere inside the star. If we assume the physics are the same for the rest of the star (which they mostly are!) our model does a pretty good job.
Second, it is worth noting that our model assumes the same step length each time the photon moves. In reality, this is an average step length. There is a lot of randomness inside of stars — sometimes the photon barely jumps and sometimes it jumps a lot! But our step length (often referred to scientifically as the "mean free path" which just means the average unobstructed path of the photon) is still a really good estimate of the photon's average step size!
We want to find how long it takes a real photon to escape the Sun. Let's assume your step length in your model is equal to 1 cm (which is pretty accurate for the Sun). Set the radius of your star to equal the Sun's radius in millimeters (\(R_{\odot} = 7*10^{10}~cm\)). Now run your model. What do you see happening? Is it possible to use this simulation to answer this question directly? Why or why not??
Hmm. Maybe we could find a relationship between the straight line distance the photon traveled (here the radius of our star) and the number of steps the photon takes to escape? Try a few different values (0.5, 1, 2, 3, and 5) for the average photon path length (the step_length
variable in your model) and observe how many steps it takes for the photon to escape. Run your model 3-5 times for each value of the path length and record the average number of steps (\(N\)) it takes the photon to escape the star for each path length.
The number of steps a photon takes is related to the ratio between step length and the radius of the star. What is the approximate relation between \(\dfrac{r}{l}\) and \(N\) (where l is the step length in our model)? Hint: The relation should take the form of a power law: \(N = (\dfrac{r}{l})^x\) where \(x\) is some positive integer. Use the data you collect to find \(x\). Try plotting your points and drawing a curve through them. It's ok if the curve doesn't hit every point that you measured — it should go through the average of them all. See if you can use the curve to find an integer value for \(x\). Also note that we made the radius \(R\) equal to 100 when building the model.
Now use your relation between \(\dfrac{r}{l}\) and \(N\) to calculate the number of total steps a photon needs to take to escape from the Sun. Note: You can create new cells to add any equations or expressions to help you answer this question. (For \(l\) use \(1~cm\) and for \(R\) use the radius of the Sun measured in millimeters from your equation sheet.)
Given the number of steps you estimated, now find how long it takes the photon to escape from the Sun. Does the answer surprise you? Why or why not?
The path length of a photon is affected by two physical properties of a star: the spacing of particles in the star (density) and the likelihood that each particle will interfere with the photon (not all particles interact with and redirect light in the same way). The chance that a particle will redirect (or scatter) a photon is called the "opacity". A high average opacity in a star means a high chance of light scattering off particles (which leads to a low step length) and a low opacity means a low chance of scattering (leading to a higher step length).
When either of these two factors increase (i.e. when the density or the opacity go up), the path length of the photon decreases. Thus we can reason that density and opacity are both inversely related to the path length.
This means we can write an equation for our step_length
(which we also referred to as \(l\)). If we call density \(d\) and opacity \(k\), we can change our value for \(l\) and implement the equation:
We can start by returning to our model cell and changing step_length
from 1
to:
step_length = 1 / (d * k)
Now we just have to define d
and k
. On the two lines below, define both variables, setting them each equal to 1
:
d = 1
k = 1
Your model now includes density and opacity!
Try running your model a few times with different values of density and opacity. What do you notice about the movement of the particle when you make these changes? Use the Desmos controls to zoom in on the individual steps of the particle. Does a higher opacity lead to a shorter or longer escape time? What about a higher density? Do these conclusions make sense? Discuss with your activity partner.
Using your relation between path length and escape time that you found earlier, estimate by what factor the escape time would change if the density of the star was doubled? What about if the opacity was doubled? What if the radius was doubled?
Try sketching the relationships between the key physical properties here. Make three graphs, one with density on the x-axis, one with opacity on the x-axis, and one with radius on the x-axis. Put escape time on the y-axis for all three and then plot a handful of values until you have a general relation. Are the relations intuitive? Explain to your activity partner why your curves have the shapes they do.
Nice work!! You just made a complete model of the interior of a star. That's no small accomplishment. As a group, reflect on what you learned by filling out this Post-Activity Survey. Then head over to the main table for a final discussion.