Skip to content
Snippets Groups Projects
Commit 40d813ed authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Softened gravity in the interactions

parent b11b3ea6
Branches
Tags
2 merge requests!212Gravity infrastructure,!172[WIP] Self gravity (Barnes-Hut version)
......@@ -76,7 +76,9 @@ gravity_compute_timestep_self(const struct phys_const* const phys_const,
* @param gp The particle to act upon
*/
__attribute__((always_inline)) INLINE static void gravity_first_init_gpart(
struct gpart* gp) {}
struct gpart* gp) {
gp->epsilon = 0.1; // MATTHIEU
}
/**
* @brief Prepares a g-particle for the gravity calculation
......
......@@ -47,31 +47,30 @@ __attribute__((always_inline)) INLINE static void runner_iact_grav_pp(
const float uj = r * hj_inv;
float fi, fj, W;
if(r >= hi) {
if (r >= hi) {
/* Get Newtonian graavity */
fi = mj * ir * ir * ir;
} else {
/* Get softened gravity */
kernel_grav_eval(ui, &W);
fi = mj * hi_inv3 * W;
}
if(r >= hj) {
if (r >= hj) {
/* Get Newtonian graavity */
fj = mi * ir * ir * ir;
} else {
/* Get softened gravity */
kernel_grav_eval(uj, &W);
fj = mi * hj_inv3 * W;
}
const float fidx[3] = {fi * dx[0], fi * dx[1], fi * dx[2]};
gpi->a_grav[0] -= fidx[0];
gpi->a_grav[1] -= fidx[1];
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment