Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sinks in the kd tree #620

Draft
wants to merge 29 commits into
base: master
Choose a base branch
from
Draft

Conversation

Yrisch
Copy link
Contributor

@Yrisch Yrisch commented Feb 13, 2025

Type of PR:
modification to existing code

Description:
Add an option to construct the kd tree using SPH and sink particles. It is then possible to compute sink-gas and sink-sink long-range interactions using the main force routine.
This can be useful when the number of sinks inside a simulation is high. In that case, the direct sink-gas direct $\mathcal{O}(N_\text{sink}N_\text{SPH})$ interaction starts to be the main bottleneck. The new method can bring back the complexity of this interaction to $\mathcal{O}(N_\mathrm{sink}\mathrm{log}(N_\mathrm{gas}) + N_\mathrm{gas}\mathrm{log}(N_\mathrm{sink}))$ at a cost of 2nd order multipole accuracy. To use with care !
The implementation uses a runtime flag that will change the maxp value to maxp = maxp + maxptmass. This ensures to have enough space in xyzh_soa and iphase_soa to push sink positions, masses and the new isink phase. The only modification in the tree construction is a loop on point masses in construct_root_node. Despite that, the tree is built the same as before.
Few conditions in multiple files are necessary to avoid using sinks in neighbour loops. The main force loop has been modified to identify sink particles. Sink-gas short-range interactions are softened the same way as the direct method. short sink-sink interactions are skipped to be computed within substep routine.

Finally, during one step, sink velocities need to be kicked with these new forces during the upper-level integration like SPH particles. To agree with the Individual timestep scheme, sinks are always considered active (smallest bin) for now.

Testing:
Same tests as in test_grav with the new method

Did you run the bots? no

Did you update relevant documentation in the docs directory? no

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant