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

Apply the correction for inhibited particle in the star self loops following...

Apply the correction for inhibited particle in the star self loops following 4630b019.
parent 9268ca83
No related branches found
No related tags found
1 merge request!750Stars use sort
...@@ -91,8 +91,8 @@ void DOSELF1_STARS(struct runner *r, struct cell *c, int timer) { ...@@ -91,8 +91,8 @@ void DOSELF1_STARS(struct runner *r, struct cell *c, int timer) {
const struct cosmology *cosmo = e->cosmology; const struct cosmology *cosmo = e->cosmology;
/* Anything to do here? */ /* Anything to do here? */
if (c->hydro.count == 0 || c->stars.count == 0) return;
if (!cell_is_active_stars(c, e)) return; if (!cell_is_active_stars(c, e)) return;
if (c->hydro.count == 0 && c->stars.count == 0) return;
/* Cosmological terms */ /* Cosmological terms */
const float a = cosmo->a; const float a = cosmo->a;
...@@ -108,7 +108,7 @@ void DOSELF1_STARS(struct runner *r, struct cell *c, int timer) { ...@@ -108,7 +108,7 @@ void DOSELF1_STARS(struct runner *r, struct cell *c, int timer) {
/* Get a hold of the ith spart in ci. */ /* Get a hold of the ith spart in ci. */
struct spart *restrict si = &sparts[sid]; struct spart *restrict si = &sparts[sid];
if (!spart_is_active(si, e) || spart_is_inhibited(si, e)) continue; if (!spart_is_active(si, e)) continue;
const float hi = si->h; const float hi = si->h;
const float hig2 = hi * hi * kernel_gamma2; const float hig2 = hi * hi * kernel_gamma2;
...@@ -121,7 +121,9 @@ void DOSELF1_STARS(struct runner *r, struct cell *c, int timer) { ...@@ -121,7 +121,9 @@ void DOSELF1_STARS(struct runner *r, struct cell *c, int timer) {
/* Get a pointer to the jth particle. */ /* Get a pointer to the jth particle. */
struct part *restrict pj = &parts[pjd]; struct part *restrict pj = &parts[pjd];
const float hj = pj->h;
/* Early abort? */
if (part_is_inhibited(pj, e)) continue;
/* Compute the pairwise distance. */ /* Compute the pairwise distance. */
const float pjx[3] = {(float)(pj->x[0] - c->loc[0]), const float pjx[3] = {(float)(pj->x[0] - c->loc[0]),
...@@ -136,8 +138,8 @@ void DOSELF1_STARS(struct runner *r, struct cell *c, int timer) { ...@@ -136,8 +138,8 @@ void DOSELF1_STARS(struct runner *r, struct cell *c, int timer) {
error("Particle pj not drifted to current time"); error("Particle pj not drifted to current time");
#endif #endif
if (r2 > 0.f && r2 < hig2) { if (r2 < hig2) {
IACT_STARS(r2, dx, hi, hj, si, pj, a, H); IACT_STARS(r2, dx, hi, pj->h, si, pj, a, H);
} }
} /* loop over the parts in ci. */ } /* loop over the parts in ci. */
} /* loop over the sparts in ci. */ } /* loop over the sparts in ci. */
...@@ -749,6 +751,9 @@ void DOSELF1_SUBSET_STARS(struct runner *r, struct cell *restrict ci, ...@@ -749,6 +751,9 @@ void DOSELF1_SUBSET_STARS(struct runner *r, struct cell *restrict ci,
const int count_i = ci->hydro.count; const int count_i = ci->hydro.count;
struct part *restrict parts_j = ci->hydro.parts; struct part *restrict parts_j = ci->hydro.parts;
/* Early abort? */
if (count_i == 0) return;
/* Loop over the parts in ci. */ /* Loop over the parts in ci. */
for (int spid = 0; spid < scount; spid++) { for (int spid = 0; spid < scount; spid++) {
...@@ -770,7 +775,9 @@ void DOSELF1_SUBSET_STARS(struct runner *r, struct cell *restrict ci, ...@@ -770,7 +775,9 @@ void DOSELF1_SUBSET_STARS(struct runner *r, struct cell *restrict ci,
/* Get a pointer to the jth particle. */ /* Get a pointer to the jth particle. */
struct part *restrict pj = &parts_j[pjd]; struct part *restrict pj = &parts_j[pjd];
const float hj = pj->h;
/* Early abort? */
if (part_is_inhibited(pj, e)) continue;
/* Compute the pairwise distance. */ /* Compute the pairwise distance. */
const float pjx[3] = {(float)(pj->x[0] - ci->loc[0]), const float pjx[3] = {(float)(pj->x[0] - ci->loc[0]),
...@@ -786,8 +793,8 @@ void DOSELF1_SUBSET_STARS(struct runner *r, struct cell *restrict ci, ...@@ -786,8 +793,8 @@ void DOSELF1_SUBSET_STARS(struct runner *r, struct cell *restrict ci,
#endif #endif
/* Hit or miss? */ /* Hit or miss? */
if (r2 > 0.f && r2 < hig2) { if (r2 < hig2) {
IACT_STARS(r2, dx, hi, hj, spi, pj, a, H); IACT_STARS(r2, dx, hi, pj->h, spi, pj, a, H);
} }
} /* loop over the parts in cj. */ } /* loop over the parts in cj. */
} /* loop over the parts in ci. */ } /* loop over the parts in ci. */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment