SWIFTSIM / HBTplus

HBTplus halo finder adapted for the FLAMINGO and COLIBRE simulations
0 stars 0 forks source link

Use collisionless particles to determine halo position and velocity for merging #4

Closed jchelly closed 5 months ago

jchelly commented 5 months ago

This PR will limit the particles used in the merging calculation to collisionless types. We would also like to avoid using the velocity of a single particle as the velocity of the satellite when checking for mergers.

I've started by modifying the code to use the BuildPosition and BuildVelocity functions for both satellites and centrals when determining if halos have merged. Central and satellite position/velocity is then the mass weighted mean of the most bound NumPartCoreMax=20 particles.

jchelly commented 5 months ago

We need to decide what to do when there aren't enough collisionless particles. We could either use the most bound of the other particles, or just use fewer particles.

This may not matter if we also impose a minimum number of collisionless particles per halo.

jchelly commented 5 months ago

This now prefers to use tracers to compute the halo position and velocity for merging, but will use non-tracer types if there are fewer than NumPartCoreMax=20 tracer type particles.

I've also added a unit test for the DMO case. New unit tests can be added by placing a source file in ./tests/ and adding it's name in tests/CMakeLists.txt. Tests can be run with "make test" in the build directory.

jchelly commented 5 months ago

There are already some tests in src/tests (which I hadn't spotted until now!), but they seem to test basic language and library features rather than HBT itself.

jchelly commented 5 months ago

In DMO runs the only thing that changes is the number of particles used to compute satellite positions and velocities. This has very little effect on the mass function in L1000N0900/DMO_FIDUCIAL, so at least nothing has been dramatically broken: mass_function_all And for just FoF groups with masses 1e13 to 1e14 Msolar/h: mass_function_fof_1e13_1e14

robjmcgibbon commented 5 months ago

Is it ok if I review this now or are you still working on it @jchelly?

jchelly commented 5 months ago

I haven't tried it out on a hydro run yet. I'll set that up now.

jchelly commented 5 months ago

Here's the effect on the mass function on L1000N0900/HYDRO_FIDUCIAL. hydro_mass_function_all

jchelly commented 5 months ago

And the stellar mass function: stellar_mass_function_all