James Berrow's Avatar

James Berrow

@spacejames.bsky.social

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

104 Followers  |  68 Following  |  128 Posts  |  Joined: 31.08.2023  |  1.9619

Latest posts by spacejames.bsky.social on Bluesky

Video thumbnail

There's always something deeply satisfying about watching a #blackhole pop into the universe

17.07.2025 22:01 β€” πŸ‘ 1    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0
Video thumbnail

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

11.06.2025 17:01 β€” πŸ‘ 0    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0
Post image

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!

03.06.2025 06:17 β€” πŸ‘ 1    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0
Video thumbnail

This is how galaxies work, right? Right? Probably needs a bit more work

29.05.2025 22:47 β€” πŸ‘ 0    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0

I sunk some time into this recently! Sadly the naive approach of trying to directly use gaia parallax didn't pan out - I was a bit optimistic about its accuracy. Looks like a more sensible approach is to fit star distance based on proper velocities + radial profile I'd guess, so take 2!

28.05.2025 17:38 β€” πŸ‘ 1    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0

Now I have my favourite thing ever, which is a hardcoded table that looks like this:

std::vector<int> data_lengths{
7,12,12,10,10,11,12,11,11,7,7,8,8,1,3,3,7,11,12,11,11,3,8,6,19,6,12,5,12,5,11,9,10,9,6,2,1};

Still, hard to be anything other than happy the data exists for free and easily available

27.05.2025 00:59 β€” πŸ‘ 0    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0

Those byte offsets and type sizes (eg 220-221 + I2) should be much larger, which renders all the offsets later in the file broken as well. The joys of data processing

27.05.2025 00:57 β€” πŸ‘ 0    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0

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

27.05.2025 00:56 β€” πŸ‘ 1    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0
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

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

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:

26.05.2025 20:22 β€” πŸ‘ 1    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0

"Industry built on crime would collapse if the law was enforced"

26.05.2025 15:58 β€” πŸ‘ 2    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0

I'm going to guess I might be able to guess the mass from the star's magnitude, seems fraught with errors though

25.05.2025 19:17 β€” πŸ‘ 0    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0

It looks like:

1. Distances for many stars comes from gaia
2. The z component of the velocity comes from omegacat I
3. I'll have to build an approximate model to fit the other stars roughly based on their proper motion + position

Absolutely no idea how to determine mass though

25.05.2025 19:15 β€” πŸ‘ 0    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0

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

25.05.2025 19:14 β€” πŸ‘ 0    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0

More technically its a measure of the constraint error. This *can* be a useful measure of how inaccurate the simulation is (though its tricky to interpret it like that), but its a very good metric of whether or not the simulation is likely to stop functioning altogether

24.05.2025 15:32 β€” πŸ‘ 1    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0

The nuclear option would be to decouple the particle step rate from the grid step rate, which could probably push it up into ~1 billion with some tweaks. Do I need a billion stars? ..maybe

24.05.2025 05:51 β€” πŸ‘ 0    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0

Each star at the moment is discretised into a volume of 4x4x4 grid cells. While 1 grid cell is too few (and introduces systematic errors), you can in theory shrink the size to 2x2x2. That solves 50% of the next performance step up - the particle stepping would be the next big problem

24.05.2025 05:46 β€” πŸ‘ 0    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0
Video thumbnail

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*

24.05.2025 05:43 β€” πŸ‘ 1    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0

Top left is a measure of how unhappy the sim is. If it looks like a disco rave ball, that means things are going poorly

24.05.2025 02:08 β€” πŸ‘ 1    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0
Video thumbnail

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

24.05.2025 00:39 β€” πŸ‘ 25    πŸ” 3    πŸ’¬ 2    πŸ“Œ 0
Video thumbnail

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

23.05.2025 03:31 β€” πŸ‘ 2    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0

I've always wanted to build a fully relativistic galaxy simulation. This is based on some particle dynamics I put together a few years ago that I found a few major mistakes in (as well as relying on a paper with bad equations), so fingers crossed that it all Magically Worksβ„’

23.05.2025 01:48 β€” πŸ‘ 3    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0
Video thumbnail

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!

23.05.2025 01:41 β€” πŸ‘ 4    πŸ” 1    πŸ’¬ 1    πŸ“Œ 0

I clicked on *one* bike fork on amazon recently, and for 2 months I got nothing but bike fork ads. Apparently there was a 0% chance I wanted anything but a bike fork, which was now the sole object of desire in my life

People say that targeted ads are amazing, but seems remarkably poor marketing

22.05.2025 15:13 β€” πŸ‘ 1    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0

Yeah that's the intent! This kind of setup is working with 'collisionless particles', so this can represent any object with gravity which doesn't (meaningfully) interact with its surroundings

22.05.2025 14:19 β€” πŸ‘ 1    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0

This is a test case of a cloud of 200k stars collapsing. The initial velocity distribution and mass distribution isn't anything real though, I'm more just checking that this all works correctly

There's enough particles now to be able to put together a decent galaxy sim, or perhaps even a cluster!

22.05.2025 12:08 β€” πŸ‘ 1    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0
Video thumbnail

2 million particles! I left this one running for a while, just because I thought it was pretty darn cool

21.05.2025 22:47 β€” πŸ‘ 4    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0

Now I could fix this, *or* I could just keep hitting zero on my keyboard

...

21.05.2025 18:17 β€” πŸ‘ 2    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0

The rendering really was not built for this so there's a lot of artifacting. The initial conditions are also very basic - but heavily complicated by trying to avoid this test case from collapsing into a black hole

21.05.2025 18:16 β€” πŸ‘ 0    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0
Video thumbnail

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

21.05.2025 18:15 β€” πŸ‘ 14    πŸ” 1    πŸ’¬ 2    πŸ“Œ 1
Video thumbnail

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

20.05.2025 19:17 β€” πŸ‘ 2    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0

@spacejames is following 20 prominent accounts