Skip to content

Fix very old gas neighbour finding bug

Matthieu Schaller requested to merge fix_hydro_subset_self_bug into master

Do not escape neighbours at the exact same position in DOSELF_SUBSET(). They may genuinely overlap!

This fixes a bug that may have been in the code forever. :/

When a gas particle needs to correct its smoothing length (i.e. call the _SUBSET() functions), we were ignoring particles at a distance of 0. (The idea was likely to prevent the particle from interacting with itself)

However, because of rounding, we can be in a situation where particles are close and get their distance rounded down to (float) 0. Now, in real-life application that should not happen unless you are a victim of the pairing instability. Still, we should not rely on good behaviour. This fixes that by escaping the self-interaction in a better way.

Now, there is one major issue. It crashes the planetary example. At least in its current form, it looks like the scheme was relying heavily on skipping ngbs in high-density regions.

The other pure hydro tests seem to be fine, even when using bad kernels.

Merge request reports