Sign in

James Berrow

@spacejames.bsky.social
119 followers 72 following 129 posts

C++/OpenCL/Binary Black Hole collisions. Space and astrophysics, with a side dish of cats 20k.github.io

PostsRepliesMedia
James Berrow @spacejames.bsky.social · 17/07/2025
There's always something deeply satisfying about watching a #blackhole pop into the universe
010
James Berrow @spacejames.bsky.social · 11/06/2025
You know, somehow I *don't* think that this is how orbits work It took a while to track this one down, but its related to using trilinear interpolation, instead of a higher order interpolation scheme like tricubic
000
James Berrow @spacejames.bsky.social · 03/06/2025
After much umming and erring, I finally figured out an easy way to build a galaxy with a z component that didn't involve like 8 integrals. Time to see if it'll actually simulate correctly!
010
James Berrow @spacejames.bsky.social · 29/05/2025
This is how galaxies work, right? Right? Probably needs a bit more work
000
James Berrow @spacejames.bsky.social · 26/05/2025
On one hand, being on bsky instead of twitter has hurt me professionally On the other hand, one of my friend's entire family tree was murdered by nazis, and they're the sole surviving branch of a giant tree of thousands of people Its not an especially difficult choice. Here's a cat:
Its a cat. She's called wesley. She's a very good cat, despite her love of sneezing in my face, and her ability to become airborne immediately in any environment just by walking in the room. Every time I open an amazon parcel, I find bits of her fur in it. I worry that one day I'll wake up, and I'll simply have become a pile of her fur which has sprung to life and begun to go about my daily tasks
010
James Berrow @spacejames.bsky.social · 24/05/2025
There's some part of my brain which goes: We've had 1 million stars, but what about 10 million? It turned out to be easier than I expected to optimise - I just had to sort the particles to optimise the memory layout I'm not even sure what to do with this many stars, and yet *what if 100 million*
110
James Berrow @spacejames.bsky.social · 24/05/2025
One way of modelling hawking radiation is as an infalling negative energy. The simulation hates it, but its possible to chuck negative mass particles into a black hole and (partially) evaporate it Evaporating it more than this has a tendency to cause big explosions, super tricky to model #astro
2253
James Berrow @spacejames.bsky.social · 23/05/2025
The coolest thing about doing relativistic N body over newtonian N body? You can build black holes out of the particles! Its even the correct mass too
020
James Berrow @spacejames.bsky.social · 23/05/2025
Some performance optimisations later, and 1M particles is running pretty well now. I tend to leave these test cases going for a while just because they look cool I think its finally time to go simulate some real things and see how well this works!
141
James Berrow @spacejames.bsky.social · 21/05/2025
2 million particles! I left this one running for a while, just because I thought it was pretty darn cool
040
James Berrow @spacejames.bsky.social · 21/05/2025
The best part about GPU programming is that once you have 2 of something working, you can just start hitting 0 on your keyboard and see what happens. First test of 200k particles for fully relativistic N-body #astro
2141
James Berrow @spacejames.bsky.social · 20/05/2025
Finally got the sanity test on the relativistic particle dynamics to work correctly (!) - turns out one of the papers I'm looking at got their equations all wrong which has made this a very good time
020
James Berrow @spacejames.bsky.social · 18/05/2025
Oh boy, started working on particles and my favourite bug has turned up - where they just randomly drift off into space because of floating point problems
130
James Berrow @spacejames.bsky.social · 07/05/2025
This is really super critical science
000
James Berrow @spacejames.bsky.social · 03/05/2025
Herbie (herbie.uwplse.org) has got to be one of the coolest tools for improving floating point equations. I don't think I've ever seen it call out one of my equations for being quite *this* terrible before though! Though, for some reason herbie has developed a passionate hatred for squaring things
000
James Berrow @spacejames.bsky.social · 30/04/2025
This is a colour version of the above, but shorter lived as I was experimenting with some tighter numerical bounds - that didn't pan out (and the sim blew up). Very tempted to try something crazy like the projective reals, or unums or something
110
James Berrow @spacejames.bsky.social · 30/04/2025
Super duper long running inspiral of some low mass neutron stars. Interesting to watch a whole bunch of material get jettisoned, as well as the resulting accretion disk getting eaten. Some problems with mass loss here due to the numerics sadly
110
James Berrow @spacejames.bsky.social · 29/04/2025
Neutron star mergers with colour might be my new favourite thing, it adds a tonne of visual depth to how everything looks #astro
2192
James Berrow @spacejames.bsky.social · 29/04/2025
I really don't have a good reason for spending so much time putting my cat on neutron stars
020
James Berrow @spacejames.bsky.social · 29/04/2025
Its an image I used for an old article:
Its a very long stretched picture of a cat, with a second cat randomly slapped on in the middle because it was the correct positioning for an old article. There are stars, and a rainbow, and everything is purple. The subtext is that the author is insane
010
James Berrow @spacejames.bsky.social · 29/04/2025
you can never have too many cats
120
James Berrow @spacejames.bsky.social · 29/04/2025
mrow
110
James Berrow @spacejames.bsky.social · 29/04/2025
Finally got around to something I've been wanting to do for yonks, which is arbitrary colour distributions for neutron stars. Now you can watch them spin, and see how they mix internally! The spin conservation is also way *way* better than I ever expected, so that's exciting too #astro
1203
James Berrow @spacejames.bsky.social · 15/04/2025
This kind of thing literally never gets old to simulate
0104
James Berrow @spacejames.bsky.social · 08/04/2025
Neutron stars: One thing I think is interesting is that there's no unique way to determine the density at the centre of a neutron star, just from its mass. Here's a plot central matter densities (ie follow the curve from the top left, rightwards, this is increasing density), showing multiple options
Mass vs radius curve for a neutron star, showing that for each possible mass, there are multiple possible radiuses
1121
James Berrow @spacejames.bsky.social · 01/04/2025
I've had my crash course in fluid dynamics now and implemented a flux conservative high resolution shock capturing scheme. Super interesting to see just how much better the results are vs a traditional discretisation if you're a nooby pde solver like me! Still some minor mass gain to sort out
110
James Berrow @spacejames.bsky.social · 26/03/2025
Fluid dynamics is even worse than NR! I have no idea how people working on hydrodynamics stay sane. On the plus size, I've ironed out a dozen bugs with these neutron star collisions now, so some aspects of this are looking a lot less sketchy now
030
James Berrow @spacejames.bsky.social · 17/03/2025
Chasing down a nasty error: Left is a standard substitution of the christoffel symbol, right is with that substitution disabled. Top left is a measure of the Γᶦ error: Left clearly has higher error, yet much better results, as the right sim fails!
100
James Berrow @spacejames.bsky.social · 17/03/2025
On the plus side, adding some constraint damping to the original test case gives a very nice looking inspiral On the downside, its still hard to know if its truly correct!
000
James Berrow @spacejames.bsky.social · 17/03/2025
And another one, where the minimum density is dropped to 1e-8. The alarming thing is that none of these choices are incorrect as such, and essentially effect the tiny erroneous atmosphere that pops up around the edge of the neutron star - which is a known problem in non atmo hydro
100
James Berrow @spacejames.bsky.social · 17/03/2025
Here's another test case with a very minor tweak applied, around exactly how extremely tiny values < 1e-7 are flushed to zero:
100
James Berrow @spacejames.bsky.social · 17/03/2025
Most hydrodynamic simulations have a pervasive thin atmosphere in the simulation, and I'm starting to see why. The issue is, at the edge of the star in non atmospheric hydro, there's a true discontinuity which can severely affect inspiral based on minor numerical changes
100
James Berrow @spacejames.bsky.social · 13/03/2025
This is another one with two lower mass stars, showing them mixing together. Its not a proper circular inspiral though (I don't have a test case for non bh collapses yet!)
110
James Berrow @spacejames.bsky.social · 13/03/2025
So in this test case, you can see *right* at the end that they've actually formed a black hole after smashing into each other, after which the sim immediately blows up (because its not currently adapted for black holes to pop up) Here's an example of successful black hole formation
110
James Berrow @spacejames.bsky.social · 13/03/2025
Neutron star inspirals are pretty awesome: I rotated the background so you can see the gravitational lensing better. Testing out some different initial gauge conditions, which seems to have made a surprisingly large difference to energy conservation! #astro
2212
James Berrow @spacejames.bsky.social · 09/03/2025
So many orbits, so few numerical problems (!). If anyone just so happens to have a physical neutron star test case that includes the linear ADM momentum on hand, I can offer you pictures of my cat in exchange. Surprisingly hard to find explicit numbers for test cases here
110
James Berrow @spacejames.bsky.social · 08/03/2025
It looks like the next step to get circular neutron star inspirals is (..finally) working nicely. Its good enough that I think I can declare the underlying hydrodynamics functional! Turns out there was a lot of gauge-condition-itus, as well as some constraint-damping-itus, as per normal. #astro
1110
James Berrow @spacejames.bsky.social · 05/03/2025
Pinned down why my neutron stars blow up after an orbit (its always the gauge conditions), and now its looking a lot better! Getting circular inspirals is going to be a lot more work
010
James Berrow @spacejames.bsky.social · 05/03/2025
I'm rasterising out the current slice, rather than the more technically accurate 4d view - as the 'real' view struggles in long running sims with highly dynamic elements on smaller timescales. The memory requirement becomes very high to take granular enough snapshots to do proper 4d geodesic tracing
000
James Berrow @spacejames.bsky.social · 05/03/2025
My next job is getting binary neutron inspirals to work accurately, which involves a lot of simulating and debugging. This I thought was a very fun case along the way, showing two neutron stars getting absolutely shredded, before recoalescing and forming a #blackhole
100
James Berrow @spacejames.bsky.social · 03/03/2025
Full 4d view of two neutron stars collapsing into a #blackhole, with redshift! I always thought they way they quietly redshift out of existence was super cool Some matter poking through the event horizon (the speckles) due to the extremely low render res, but pretty decent otherwise! #astro
2307
James Berrow @spacejames.bsky.social · 26/02/2025
On a technical note, I'm currently in the process of validating exactly how correct these simulations are, and looking for obvious defects. So, here's a bonus run with the viscosity turned off, showing largely the same situation - though the interior differential rotation is a bit more obvious
100
James Berrow @spacejames.bsky.social · 26/02/2025
Reimplemented my favourite feature: Colour! Its great for tracking how two neutron stars mix together after colliding Two low mass neutron stars here. Interestingly, it seems like at some of the final neutron star is spinning in the opposite direction under the surface, which is.. odd #astro
160
James Berrow @spacejames.bsky.social · 25/02/2025
Better view of two neutron stars detonating after colliding. The simulation area is fairly small here (you can see the gas hitting the walls), so it took a bit of implementing to sneak the camera outside the bounding box. Probably the coolest test case I've seen in a while #astro #gpgpu
0101
James Berrow @spacejames.bsky.social · 25/02/2025
TIL: You can smash two neutron stars together, and they'll sometimes fully detonate without even leaving behind a remnant. The individual masses here are ~1.6x the sun, so they aren't exactly small
020
James Berrow @spacejames.bsky.social · 24/02/2025
Turns out the tail of gas that doesn't get absorbed into a #blackhole on a glancing blow can end up accelerating to ludicrous speeds (plaid?) - which breaks absolutely everything. Been trying to solve this one for a while - haven't really seen a good solution in the literature for it! #astro
000
James Berrow @spacejames.bsky.social · 24/02/2025
Successfully smashing together two neutron stars, to make a #blackhole. The amount of extra resolution you need to simulate a black hole compared to a neutron star is kind of nuts
041
James Berrow @spacejames.bsky.social · 22/02/2025
The solution, as always, is to arbitrarily add more damping. Its now exactly the correct kind of approximate wobbly mess Matter sims really suck eh
010
James Berrow @spacejames.bsky.social · 22/02/2025
Tracking down things that can cause a #neutronstar to blow up (unintentionally). This one was a huge pain. It turns out that the initial collapse in the gauge conditions breaks a spinning neutron star very badly, but it was disguised (?) in older papers due to low resolution #c++ #gpgpu #bssn
110
James Berrow @spacejames.bsky.social · 18/02/2025
It only took an solid week to get my #neutronstar to move around the grid correctly (and spin!). Getting the initial conditions to work feels like a dark magic summoning ritual, I've never solved a problem where *nothing* has an analytic solution, and there isn't even a theoretical answer. #gpgpu
020