Adaptive softening for the gas
Implements adaptive softening for the gas when using the Wendland-C2 kernel (i.e. the kernel used in the gravity solver). Equations taken straight from https://ui.adsabs.harvard.edu/abs/2007MNRAS.374.1347P/abstract but with the terms altered for the Wendland kernel.
Changes:
- Add new config option to activate the adaptive softening (
--with-adaptive-softening
), - The gravity scheme uses the gas'
h
asepsilon
- A min and max can be applied via the gravity section of the parameter file.
- The gravity loops and initial comms are taking place after the hydro ghost.
- The hydro scheme (SPH only) includes extra momentum terms accounting for the change in softening.
- the "baryon softening" constants given in the parameter files then only apply to stars and BHs.
Todo:
-
Same for the other hydro schemes. -
Document the new behaviour in the RTD. -
Update the unit tests and tools.c
Closes #879 (closed).
Merge request reports
Activity
added SPH feature request labels
requested review from @mivkov
assigned to @jborrow
added 1 commit
- 84b30ea7 - Add script to plot the energy evolution of the Evrard collapse
A couple of questions:
- Why are we using a fixed kernel (wendland-C2) and not the kernel we use for the hydro?
- The way that the correction is applied in each hydro seems to have nothing to do with the hydro itself. Why are we doing this in each hydro_iact and not centrally in the runner? I guess this would be different for e.g. voronoi or GIZMO, but does that then not imply that we should have this correction as part of the hydro functions?
Two good questions.
I am doing this using the Wendland-C2 as this is the gravity kernel we use. It has to be consistent. And, we use the Wendland-C2 for gravity as it has no branching which allows for vectorization.
As for the extra term, I was thinking of doing it the way you imagine. But, the problem is that the term requires f_ij, which is not defined in the same way in all the schemes. So, unless, I compute another f_ij term within the adaptive softening bit (which would duplicate variables) then I have to resort to the current solution.
- Resolved by Josh Borrow
- Resolved by Matthieu Schaller
- Resolved by Matthieu Schaller
- Resolved by Matthieu Schaller
102 103 103 104 /* Drift before you send */ 104 105 scheduler_addunlock(s, ci->grav.super->grav.drift, t_grav); 106 107 if (gravity_after_hydro_density) 108 scheduler_addunlock(s, ci->grav.super->grav.init_out, t_grav); I think not. Here is why.
If two particles interact they both need their softenings computed. That means they both need to have completed thei ghost tasks. If on different nodes then they will complete that locally. That ghost task then updates the gpart's softening. Here, we delay the gpart send to after the ghost. This guarantees that the softening computation is complete before sending the gpart and thus before doing the gravity operations on the foreign node.
added 1 commit
- b5a59c7f - Fix typo in adaptive_softening_get_acc_term()
added 16 commits
-
b5a59c7f...b755d64d - 15 commits from branch
master
- 0b1939cb - Merge branch 'master' into adaptive_softening
-
b5a59c7f...b755d64d - 15 commits from branch
added 7 commits
- 7a09717a - Added the particle-carried fields to all the other SPH schemes
- 7f43983e - Added the zeta term calculation to the density loop of all the other SPH schemes
- 9d2cad03 - Add the adaptive softening correction term to the SPH force equation to the other SPH schemes
- b5e93f7a - Allow compilation with adaptive softening in all SPH schemes
- d1d49c38 - Update the brute-force checking functions in tools.c
- b9c23b18 - Update the brute-force checking functions in tools.c
- ee1da494 - Updated the unit tests to call the new adaptive softening functions
Toggle commit listadded 1 commit
- ab772682 - Prevent the adaptive softening scheme from being used with the basic gravity scheme
added 1 commit
- 222d6333 - Allow runs without gravity to work by not accessing the gpart pointer if it does not exist
added 1 commit
- 75d2ae34 - Allow runs without gravity to work by not accessing the gpart pointer if it does not exist
mentioned in commit 43c583a7