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

Backport changes to the AGN tracers from the COLIBRE fork

parent 61ce63bc
No related branches found
No related tags found
No related merge requests found
...@@ -29,18 +29,19 @@ ...@@ -29,18 +29,19 @@
* @param bi First particle (black hole). * @param bi First particle (black hole).
* @param pj Second particle (gas, not updated). * @param pj Second particle (gas, not updated).
* @param xpj The extended data of the second particle (not updated). * @param xpj The extended data of the second particle (not updated).
* @param with_cosmology Are we doing a cosmological run?
* @param cosmo The cosmological model. * @param cosmo The cosmological model.
* @param grav_props The properties of the gravity scheme (softening, G, ...). * @param grav_props The properties of the gravity scheme (softening, G, ...).
* @param ti_current Current integer time value (for random numbers). * @param ti_current Current integer time value (for random numbers).
* @param time current physical time in the simulation
*/ */
__attribute__((always_inline)) INLINE static void __attribute__((always_inline)) INLINE static void
runner_iact_nonsym_bh_gas_density(const float r2, const float *dx, runner_iact_nonsym_bh_gas_density(
const float hi, const float hj, const float r2, const float *dx, const float hi, const float hj,
struct bpart *bi, const struct part *pj, struct bpart *bi, const struct part *pj, const struct xpart *xpj,
const struct xpart *xpj, const int with_cosmology, const struct cosmology *cosmo,
const struct cosmology *cosmo, const struct gravity_props *grav_props, const integertime_t ti_current,
const struct gravity_props *grav_props, const double time) {
const integertime_t ti_current) {
float wi, wi_dx; float wi, wi_dx;
...@@ -80,18 +81,21 @@ runner_iact_nonsym_bh_gas_density(const float r2, const float *dx, ...@@ -80,18 +81,21 @@ runner_iact_nonsym_bh_gas_density(const float r2, const float *dx,
* @param bi First particle (black hole). * @param bi First particle (black hole).
* @param pj Second particle (gas) * @param pj Second particle (gas)
* @param xpj The extended data of the second particle. * @param xpj The extended data of the second particle.
* @param with_cosmology Are we doing a cosmological run?
* @param cosmo The cosmological model. * @param cosmo The cosmological model.
* @param grav_props The properties of the gravity scheme (softening, G, ...). * @param grav_props The properties of the gravity scheme (softening, G, ...).
* @param ti_current Current integer time value (for random numbers). * @param ti_current Current integer time value (for random numbers).
* @param time current physical time in the simulation
*/ */
__attribute__((always_inline)) INLINE static void __attribute__((always_inline)) INLINE static void
runner_iact_nonsym_bh_gas_swallow(const float r2, const float *dx, runner_iact_nonsym_bh_gas_swallow(const float r2, const float *dx,
const float hi, const float hj, const float hi, const float hj,
const struct bpart *bi, struct part *pj, const struct bpart *bi, struct part *pj,
struct xpart *xpj, struct xpart *xpj, const int with_cosmology,
const struct cosmology *cosmo, const struct cosmology *cosmo,
const struct gravity_props *grav_props, const struct gravity_props *grav_props,
const integertime_t ti_current) {} const integertime_t ti_current,
const double time) {}
/** /**
* @brief Swallowing interaction between two BH particles (non-symmetric). * @brief Swallowing interaction between two BH particles (non-symmetric).
...@@ -127,18 +131,21 @@ runner_iact_nonsym_bh_bh_swallow(const float r2, const float *dx, ...@@ -127,18 +131,21 @@ runner_iact_nonsym_bh_bh_swallow(const float r2, const float *dx,
* @param bi First particle (black hole). * @param bi First particle (black hole).
* @param pj Second particle (gas) * @param pj Second particle (gas)
* @param xpj The extended data of the second particle. * @param xpj The extended data of the second particle.
* @param with_cosmology Are we doing a cosmological run?
* @param cosmo The cosmological model. * @param cosmo The cosmological model.
* @param grav_props The properties of the gravity scheme (softening, G, ...). * @param grav_props The properties of the gravity scheme (softening, G, ...).
* @param ti_current Current integer time value (for random numbers). * @param ti_current Current integer time value (for random numbers).
* @param time current physical time in the simulation
*/ */
__attribute__((always_inline)) INLINE static void __attribute__((always_inline)) INLINE static void
runner_iact_nonsym_bh_gas_feedback(const float r2, const float *dx, runner_iact_nonsym_bh_gas_feedback(const float r2, const float *dx,
const float hi, const float hj, const float hi, const float hj,
struct bpart *bi, struct part *pj, struct bpart *bi, struct part *pj,
struct xpart *xpj, struct xpart *xpj, const int with_cosmology,
const struct cosmology *cosmo, const struct cosmology *cosmo,
const struct gravity_props *grav_props, const struct gravity_props *grav_props,
const integertime_t ti_current) { const integertime_t ti_current,
const double time) {
#ifdef DEBUG_INTERACTIONS_BH #ifdef DEBUG_INTERACTIONS_BH
/* Update ngb counters */ /* Update ngb counters */
if (si->num_ngb_force < MAX_NUM_OF_NEIGHBOURS_BH) if (si->num_ngb_force < MAX_NUM_OF_NEIGHBOURS_BH)
... ...
......
...@@ -43,13 +43,12 @@ ...@@ -43,13 +43,12 @@
* @param ti_current Current integer time value (for random numbers). * @param ti_current Current integer time value (for random numbers).
*/ */
__attribute__((always_inline)) INLINE static void __attribute__((always_inline)) INLINE static void
runner_iact_nonsym_bh_gas_density(const float r2, const float *dx, runner_iact_nonsym_bh_gas_density(
const float hi, const float hj, const float r2, const float *dx, const float hi, const float hj,
struct bpart *bi, const struct part *pj, struct bpart *bi, const struct part *pj, const struct xpart *xpj,
const struct xpart *xpj, const int with_cosmology, const struct cosmology *cosmo,
const struct cosmology *cosmo, const struct gravity_props *grav_props, const integertime_t ti_current,
const struct gravity_props *grav_props, const double time) {
const integertime_t ti_current) {
float wi, wi_dx; float wi, wi_dx;
...@@ -129,10 +128,11 @@ __attribute__((always_inline)) INLINE static void ...@@ -129,10 +128,11 @@ __attribute__((always_inline)) INLINE static void
runner_iact_nonsym_bh_gas_swallow(const float r2, const float *dx, runner_iact_nonsym_bh_gas_swallow(const float r2, const float *dx,
const float hi, const float hj, const float hi, const float hj,
struct bpart *bi, struct part *pj, struct bpart *bi, struct part *pj,
struct xpart *xpj, struct xpart *xpj, const int with_cosmology,
const struct cosmology *cosmo, const struct cosmology *cosmo,
const struct gravity_props *grav_props, const struct gravity_props *grav_props,
const integertime_t ti_current) { const integertime_t ti_current,
const double time) {
float wi; float wi;
...@@ -343,18 +343,21 @@ runner_iact_nonsym_bh_bh_swallow(const float r2, const float *dx, ...@@ -343,18 +343,21 @@ runner_iact_nonsym_bh_bh_swallow(const float r2, const float *dx,
* @param bi First particle (black hole). * @param bi First particle (black hole).
* @param pj Second particle (gas) * @param pj Second particle (gas)
* @param xpj The extended data of the second particle. * @param xpj The extended data of the second particle.
* @param with_cosmology Are we doing a cosmological run?
* @param cosmo The cosmological model. * @param cosmo The cosmological model.
* @param grav_props The properties of the gravity scheme (softening, G, ...). * @param grav_props The properties of the gravity scheme (softening, G, ...).
* @param ti_current Current integer time value (for random numbers). * @param ti_current Current integer time value (for random numbers).
* @param time current physical time in the simulation
*/ */
__attribute__((always_inline)) INLINE static void __attribute__((always_inline)) INLINE static void
runner_iact_nonsym_bh_gas_feedback(const float r2, const float *dx, runner_iact_nonsym_bh_gas_feedback(const float r2, const float *dx,
const float hi, const float hj, const float hi, const float hj,
const struct bpart *bi, struct part *pj, const struct bpart *bi, struct part *pj,
struct xpart *xpj, struct xpart *xpj, const int with_cosmology,
const struct cosmology *cosmo, const struct cosmology *cosmo,
const struct gravity_props *grav_props, const struct gravity_props *grav_props,
const integertime_t ti_current) { const integertime_t ti_current,
const double time) {
/* Get the heating probability */ /* Get the heating probability */
const float prob = bi->to_distribute.AGN_heating_probability; const float prob = bi->to_distribute.AGN_heating_probability;
...@@ -381,7 +384,7 @@ runner_iact_nonsym_bh_gas_feedback(const float r2, const float *dx, ...@@ -381,7 +384,7 @@ runner_iact_nonsym_bh_gas_feedback(const float r2, const float *dx,
hydro_diffusive_feedback_reset(pj); hydro_diffusive_feedback_reset(pj);
/* Mark this particle has having been heated by AGN feedback */ /* Mark this particle has having been heated by AGN feedback */
tracers_after_black_holes_feedback(xpj); tracers_after_black_holes_feedback(xpj, with_cosmology, cosmo->a, time);
/* message( */ /* message( */
/* "We did some AGN heating! id %llu BH id %llu probability " */ /* "We did some AGN heating! id %llu BH id %llu probability " */
... ...
......
...@@ -44,6 +44,7 @@ void DOSELF1_BH(struct runner *r, struct cell *c, int timer) { ...@@ -44,6 +44,7 @@ void DOSELF1_BH(struct runner *r, struct cell *c, int timer) {
const struct engine *e = r->e; const struct engine *e = r->e;
const integertime_t ti_current = e->ti_current; const integertime_t ti_current = e->ti_current;
const struct cosmology *cosmo = e->cosmology; const struct cosmology *cosmo = e->cosmology;
const int with_cosmology = e->policy & engine_policy_cosmology;
/* Anything to do here? */ /* Anything to do here? */
if (c->black_holes.count == 0) return; if (c->black_holes.count == 0) return;
...@@ -100,8 +101,8 @@ void DOSELF1_BH(struct runner *r, struct cell *c, int timer) { ...@@ -100,8 +101,8 @@ void DOSELF1_BH(struct runner *r, struct cell *c, int timer) {
#endif #endif
if (r2 < hig2) { if (r2 < hig2) {
IACT_BH_GAS(r2, dx, hi, hj, bi, pj, xpj, cosmo, e->gravity_properties, IACT_BH_GAS(r2, dx, hi, hj, bi, pj, xpj, with_cosmology, cosmo,
ti_current); e->gravity_properties, ti_current, e->time);
} }
} /* loop over the parts in ci. */ } /* loop over the parts in ci. */
} /* loop over the bparts in ci. */ } /* loop over the bparts in ci. */
...@@ -187,6 +188,7 @@ void DO_NONSYM_PAIR1_BH_NAIVE(struct runner *r, struct cell *restrict ci, ...@@ -187,6 +188,7 @@ void DO_NONSYM_PAIR1_BH_NAIVE(struct runner *r, struct cell *restrict ci,
const struct engine *e = r->e; const struct engine *e = r->e;
const integertime_t ti_current = e->ti_current; const integertime_t ti_current = e->ti_current;
const struct cosmology *cosmo = e->cosmology; const struct cosmology *cosmo = e->cosmology;
const int with_cosmology = e->policy & engine_policy_cosmology;
/* Anything to do here? */ /* Anything to do here? */
if (ci->black_holes.count == 0) return; if (ci->black_holes.count == 0) return;
...@@ -252,8 +254,8 @@ void DO_NONSYM_PAIR1_BH_NAIVE(struct runner *r, struct cell *restrict ci, ...@@ -252,8 +254,8 @@ void DO_NONSYM_PAIR1_BH_NAIVE(struct runner *r, struct cell *restrict ci,
#endif #endif
if (r2 < hig2) { if (r2 < hig2) {
IACT_BH_GAS(r2, dx, hi, hj, bi, pj, xpj, cosmo, e->gravity_properties, IACT_BH_GAS(r2, dx, hi, hj, bi, pj, xpj, with_cosmology, cosmo,
ti_current); e->gravity_properties, ti_current, e->time);
} }
} /* loop over the parts in cj. */ } /* loop over the parts in cj. */
} /* loop over the bparts in ci. */ } /* loop over the bparts in ci. */
...@@ -366,6 +368,7 @@ void DOPAIR1_SUBSET_BH_NAIVE(struct runner *r, struct cell *restrict ci, ...@@ -366,6 +368,7 @@ void DOPAIR1_SUBSET_BH_NAIVE(struct runner *r, struct cell *restrict ci,
const struct engine *e = r->e; const struct engine *e = r->e;
const integertime_t ti_current = e->ti_current; const integertime_t ti_current = e->ti_current;
const struct cosmology *cosmo = e->cosmology; const struct cosmology *cosmo = e->cosmology;
const int with_cosmology = e->policy & engine_policy_cosmology;
const int count_j = cj->hydro.count; const int count_j = cj->hydro.count;
struct part *restrict parts_j = cj->hydro.parts; struct part *restrict parts_j = cj->hydro.parts;
...@@ -418,8 +421,8 @@ void DOPAIR1_SUBSET_BH_NAIVE(struct runner *r, struct cell *restrict ci, ...@@ -418,8 +421,8 @@ void DOPAIR1_SUBSET_BH_NAIVE(struct runner *r, struct cell *restrict ci,
#endif #endif
/* Hit or miss? */ /* Hit or miss? */
if (r2 < hig2) { if (r2 < hig2) {
IACT_BH_GAS(r2, dx, hi, hj, bi, pj, xpj, cosmo, e->gravity_properties, IACT_BH_GAS(r2, dx, hi, hj, bi, pj, xpj, with_cosmology, cosmo,
ti_current); e->gravity_properties, ti_current, e->time);
} }
} /* loop over the parts in cj. */ } /* loop over the parts in cj. */
} /* loop over the parts in ci. */ } /* loop over the parts in ci. */
...@@ -446,6 +449,7 @@ void DOSELF1_SUBSET_BH(struct runner *r, struct cell *restrict ci, ...@@ -446,6 +449,7 @@ void DOSELF1_SUBSET_BH(struct runner *r, struct cell *restrict ci,
const struct engine *e = r->e; const struct engine *e = r->e;
const integertime_t ti_current = e->ti_current; const integertime_t ti_current = e->ti_current;
const struct cosmology *cosmo = e->cosmology; const struct cosmology *cosmo = e->cosmology;
const int with_cosmology = e->policy & engine_policy_cosmology;
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;
...@@ -494,8 +498,8 @@ void DOSELF1_SUBSET_BH(struct runner *r, struct cell *restrict ci, ...@@ -494,8 +498,8 @@ void DOSELF1_SUBSET_BH(struct runner *r, struct cell *restrict ci,
/* Hit or miss? */ /* Hit or miss? */
if (r2 < hig2) { if (r2 < hig2) {
IACT_BH_GAS(r2, dx, hi, pj->h, bi, pj, xpj, cosmo, IACT_BH_GAS(r2, dx, hi, pj->h, bi, pj, xpj, with_cosmology, cosmo,
e->gravity_properties, ti_current); e->gravity_properties, ti_current, e->time);
} }
} /* loop over the parts in cj. */ } /* loop over the parts in cj. */
} /* loop over the parts in ci. */ } /* loop over the parts in ci. */
... ...
......
...@@ -153,7 +153,10 @@ static INLINE void tracers_after_feedback(struct xpart *xp) { ...@@ -153,7 +153,10 @@ static INLINE void tracers_after_feedback(struct xpart *xp) {
* *
* @param xp The extended particle data. * @param xp The extended particle data.
*/ */
static INLINE void tracers_after_black_holes_feedback(struct xpart *xp) { static INLINE void tracers_after_black_holes_feedback(struct xpart *xp,
const int with_cosmology,
const float scale_factor,
const double time) {
xp->tracers_data.hit_by_AGN_feedback = 1; xp->tracers_data.hit_by_AGN_feedback = 1;
} }
... ...
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment