Sign in

James Berrow

@spacejames.bsky.social
120 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 · 27/05/2025
Ok well the omegacat II data release does have the minor problem in that their data header is wrong oops! 220-221 I2 --- nitschai_id ? ID in oMEGACat I MUSE spectroscopic catalog (Nitschai et al. 2023) 223-224 I2 --- gaia_id ? Gaia Source Identifier
110
James Berrow @spacejames.bsky.social · 25/05/2025
Trying to simulate everything in omegacat II is (unsurprisingly!) a lot of work. I was (somewhat naively) hoping that there would simply be 3d positions and velocities available for everything
100
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
20k.github.io/c++/2025/05/... I've finished writing up how to implement #neutronstar collisions (with code!), and follow them through to collapsing into a black hole. Turned out quite well! There's also a small side venture on how to put a cat onto a neutron star, which is v important #astrocode
20k.github.io
Numerical Relativity 105: Smashing neutron stars together like its 2002 · James' Space Blog
Ramblings on C++, OpenCL, and GPU programming
270
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
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
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
20k.github.io/c++/2025/04/... Ever felt like building a #neutronstar, for a numerical relativistic simulation? Here's how! This is a programmer's guide (with code) on how to wrangle a specific set of initial conditions, so in the future we can smash some neutron stars together #astrocode
20k.github.io
Numerical Relativity 104: How to build a neutron star - from scratch · James' Space Blog
Ramblings on C++, OpenCL, and GPU programming
1134
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
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
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
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 · 27/02/2025
Always a fun time when you start researching a problem and discover its considered unsolved. Apparently relativistic thermodynamics is a hot spicy mess, which feels appropriate
010
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
@bot.astronomy.blue signup
100
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
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
James Berrow @spacejames.bsky.social · 15/02/2025
Hooray, one actual stable #neutronstar. It only took like a week to stop it from catastrophically exploding!
030
James Berrow @spacejames.bsky.social · 02/02/2025
20k.github.io/c++/2025/02/... The next tutorial on rasterising binary #blackhole collisions is live! #c++ #gpgpu
20k.github.io
Numerical Relativity 103: Raytracing numerical spacetimes · James' Space Blog
Ramblings on C++, OpenCL, and GPU programming
000
James Berrow @spacejames.bsky.social · 21/01/2025
Pew pew, more #blackhole mergers! Now with nicer looking graphics
020
James Berrow @spacejames.bsky.social · 18/01/2025
Tutorial on accurate #blackhole rendering is going well so far! Still some issues to iron out though
020
James Berrow @spacejames.bsky.social · 12/01/2025
20k.github.io/c++/2025/01/... Its done! Come simulate binary #blackhole collisions on a GPU, without a supercomputer
20k.github.io
Numerical Relativity 102: Simulating fast binary black hole collisions on the GPU · James' Space Blog
Ramblings on C++, OpenCL, and GPU programming
020
James Berrow @spacejames.bsky.social · 05/01/2025
So many #blackhole simulations for the next article. This is part of what makes these simulations so delightful
000
James Berrow @spacejames.bsky.social · 22/12/2024
Finally figured out what went wrong with my #alcubierre frame basis, so here's a cube trapped in a warp drive going at 2c Turns out, you need to build your frame basis twice: once to figure out which coordinate is timelike, and then re-starting your basis construction from that coordinate. Fun!
000
James Berrow @spacejames.bsky.social · 23/11/2024
It looks like bluesky's kicking off a bit which is great to see, losing the astrophysics community on twitter was very sad To celebrate, here's two #neutronstar s(ish) smashing into each other in #generalrelativity. Matter dynamics is always incredibly cool from top to bottom in GR
030
James Berrow @spacejames.bsky.social · 14/11/2024
Work for the next article on binary black hole collisions is going well, this is of the most energy lossy test case. Getting the correct number of orbits on such a low resolution is a lot of work!
000