SWIFTSIM / HBTplus

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

TracerIndex is not always kept up to date #8

Closed jchelly closed 1 month ago

jchelly commented 5 months ago

In the check_tracer_index branch I've modified the code so that TracerIndex is only accessed through GetTracerIndex and SetTracerIndex functions.

If we compile with HBT_CHECK_TRACER_INDEX=ON then SetTracerIndex records the ID of the tracer particle. GetTracerIndex checks that the particle with the specified index has the expected ID. On the small Colibre test run at /cosma7/data/dp004/dc-foro1/colibre/ this consistency check fails. This might due to the TracerIndex not being updated when particles which no longer exist are removed from the subhalo.

jchelly commented 5 months ago

Calling CountParticleTypes() (which recomputes TracerIndex) at the end of KickNullParticles() allows the test run to complete without crashing.

A better fix might be to have a separate ChooseTracer() function which we can call to recompute the tracer index. I don't think it's a good idea to just count the number of removed particles before the tracer because the tracer itself might have been removed!

jchelly commented 1 month ago

The change to fix this by calling CountParticleTypes() has been merged and the L2800N5040/HYDRO_FIDUCIAL run completed with HBT_CHECK_TRACER_INDEX=ON so I think this is fixed.