Gravitational Collapse of Spongebob
twitter.com
twitter.com
This simulation is 2D, but it's similar to what happens in globular star clusters. In these, there's a phenomenon called the "gravothermal catastrophe".
The particles (stars, sponge bits) relax to thermal equilibrium, where the kinetic energy of a particle has a distribution where probability declines exponentially in energy/temperature. Some of the particles will have energy high enough to escape to infinity (to "evaporate"). When they leave, the remaining particles are more tightly bound, so the cluster shrinks. The particles then move faster (by the virial theorem, total kinetic energy is always 1/2 the negative of the gravitational potential energy). Evaporation accelerates until the cluster basically explodes.
Why this doesn't happen to actual star clusters was eventually determined to be due to three body collisions that cause binary stars to form, and these stars then inject energy into passing stars (causing the binary star orbits to shrink). This energy injection reheats the cluster, inflating it again and preventing runaway evaporation.
I'm not clear that the simulation here can handle formation of such binaries.
> This way we avoid numerical instabilities due to divergent forces when two particles get to close together.
So it appears he doesn't handle close encounters that form binaries. Probably reasonable if he's using heavier discrete particles as a proxy for dark matter.
I get it, it was a toy, but if you're really interested look up adaptive step symplectic integrators.
This sounds very much like what happens at the end of a black hole's lifetime as it evaporates by Hawking radiation. Any chance that's a real connection?
Hm, yes, the Hawking quanta originate outside the event horizon, and not very nearby outside either (Giddings 2015 <https://arxiv.org/abs/1511.08221>, Unruh "Dumb Holes" 2007 <http://pos.sissa.it/cgi-bin/reader/conf.cgi?confid=43>).
However it's best to think of "the black hole" as the entire spacetime (in Hawking's 1974 treatment and similar; or alternatively out to somewhere in the asymptotic flatness), in which there are two regions without a horizon, one to the past of the event horizon formation, and one to the future of final evaporation.
What goes into the horizon doesn't stay in, therefore what happens inside is part of the picture (and has been speculated about for fifty years! Fifty!)
You're probably right, I appreciate your frankness. :D I'll start with trying to wrap my head around negative heat capacity.
As gravitational systems lose energy, the "temperature" of the ensemble of particles goes up. (I.e. objects with smaller orbits have higher velocities.)
It is probably not exactly an accident that this relationship holds for blackholes as well: the hawking radiation formulas suggest a larger and larger temperature for blackholes with smaller and smaller event horizons. The hawking radiation stuff is built upon entropy / temperature relationships so I think there is actually some kind of connection there.
There might even be something baked into the energy conditions / bianchi identities of GR that is manifesting in that way, but I'm speculating.
The visualization is pretty limited, and was probably just a fun way for the astrophys student to use his choice of tools. (Which we should encourage! His work is great!)
I am also not the only person to think the visualization would be useful when teaching early astro or astrophys undergrads. For example, <https://twitter.com/BenShappee/status/1769066245339402612>. (BTW, Shappee was in ASAS-SN from the start. ASAS-SN is awesome, I promote them whenever I can squeeze them in: <https://www.astronomy.ohio-state.edu/asassn/index.shtml>).
Digging deeply into the consequences of this example of obviously physically improbable initial conditions could be somewhere between entertaining and enlightening, but would quickly go over the head of early astro students first encountering the virial theorem and negative heat capacity. "Getting the physics right" would be a significant research project. You'd also generally have to do without animations, unless you are very patient and have a big compute time budget (see the acknowledgments section of the MNRAS paper below, and my final paragraph).
Motivated by the previous paragraph's themes I found a recent (2022) MNRAS open access paper which among other things has a good overview of the (recent) state of the art in modelling star clusters, some good teaching material in section 2, and in section 3 we see their software packages. I'd suggest you begin with the summary in section 6.1.
https://academic.oup.com/mnras/article/516/3/3266/6668807
In principle simulating the Spongebob cluster could produce information in the top two graphs of figure 7, and a 2d version of one or two of the graphs in figure 6. The additional information in those figures is certainly interesting, but nowhere near as pretty as the Spongebob animation. And I'm not sure what extracting similar figures for the Spongebob simulation would be useful for.
Conversely, the Spongebob simulation could not generate figure 9, and that figure is especially interesting to me (q.v. §4.2 & final sentence in §3.2).
And finally, "The movies of the full simulations, from which Fig. 6 was produced, will be made available upon reasonable request as well and will be uploaded publicly in the future". Not sure the upload ever happened, although I didn't really search much (e.g. it's not linked at the arxiv <https://arxiv.org/abs/2205.04470> or in DDG media searches on title or a few of the authors).
I have a copy of The Magic Machine on my shelf which I (unintentionally) stole from my university library at the end of my senior year. His work was pretty influential on me, inspiring me to keep exploring programming at a time when my day to day work in the subject was often painfully boring.
...but 1 second per time step is a lot. I wonder how fast it would've been if it wasn't in Python. I think we as a society are doing a whole lot of people (especially physicists) a disservice by mainly teaching them Python rather than languages which are literally hundreds of times faster in some cases. Python works well when you just want to glue together existing fast C or Fortran libraries with Python APIs, but it quickly proves limiting.
I've personally been caught by the Python trap, where the easiest way to do something was to write a Python script to do it, and it worked, but then I wanted to try to process more data or whatever, and suddenly Python is a huge limiting factor. I then spend more time parallelizing the Python code to make it run faster, and it becomes a beast that's hard to debug and which maxes out 32 CPU cores and is still 10x slower than what a single threaded Rust program would've been and I regret my choice of language.
EDIT: Also, this is in no way anti-Python, I think it's a nice language and there are many uses where it is wholly appropriate.
To get significantly better performance with a JIT, you need one which analyzes the code at runtime to detect patterns, such as "this function is always called with an integer argument" or "the dictionary passed to this function always has this shape", like what V8 does. AFAIK Numba doesn't do that.
(Though if I'm wrong and there are benchmarks which shows Numba coming close to something like Rust in normal dynamic Python code, please do correct me! I haven't done much research on Numba specifically)
Are you exaggerating? If not, can you share a bit more?
I don't think I have the code for these large-ish data processing experiments I did any more, but it would be fun to make some toy problems with large amounts of data and create comparable Python and C implementations and create a blog post with the results.
N-body simulation made with Python, parallelized with numba, and animated with matplotlib.
N=100.000. Computation time around 5h for 2.000 steps. Around 1s of compute time per step. Collisions are handled with a softening length.
Yet, making two everyday objects pass through each other is not that easy ...
Additionally, the densities of the systems are also very different (not in absolute terms of course)
As long as the 2nd law is in play, I could see the two objects as being passed through each other. One side you have particlesA[cub1_particles, new_fusion_particles] and on the other side you have particlesB[cube2_particles, new_fusion_particles]. Both of these would sum to the same thermodynamic energy of [cube1, cube2].
Right?
Good opportunity to plug https://savechandra.org/why/
NGC 2207 https://www.chandra.harvard.edu/photo/2014/ngc2207/ ("Colliding galaxies like this pair are well known to contain intense star formation. Shock waves — like the sonic booms from supersonic aircraft — form during the collision, leading to the collapse of clouds of gas and the formation of star clusters")
NGC 1232 https://chandra.harvard.edu/photo/2013/ngc1232/ (the text below the image is excellent).
Stephan's Quintet https://chandra.harvard.edu/photo/2009/stephq/ (be sure to use the "View Wavelengths" buttons right below the image, and mouse over the image for annotations)
There are lots of other examples. While brief <https://en.wikipedia.org/wiki/Interacting_galaxy#Galaxy_coll...> is decent, and can take you to the longer https://en.wikipedia.org/wiki/Galaxy_merger, which is pretty encyclopedic on that branch of galaxy-interaction outcomes.
Spongebob pretty clearly doesn't account for gas. The initial velocities are also not really comparable to a galaxy-galaxy interaction. And of course it's in two spatial dimensions, so fewer ways that any pair of particles might avoid each other than in our three.
And to answer the grandparent comment, the gravitational interaction of particle-particle close calls in Spongebob are suppressed, so no collisions. Gravitation is the only force modelled, so no clumping. I arrived at that from scattered Q&A comments in the twitter thread, but also it's pretty clear from eyeballing.