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

Also synchronize particles hit by black hole feedback.

parent a4d48ed2
Branches
Tags
1 merge request!956Fully implement the timestep limiter (non MPI)
......@@ -34,11 +34,13 @@
* @param ti_current Current integer time value (for random numbers).
*/
__attribute__((always_inline)) INLINE static void
runner_iact_nonsym_bh_gas_density(
const float r2, const float *dx, const float hi, const float hj,
struct bpart *restrict bi, const struct part *restrict pj,
const struct xpart *restrict xpj, const struct cosmology *cosmo,
const struct gravity_props *grav_props, const integertime_t ti_current) {
runner_iact_nonsym_bh_gas_density(const float r2, const float *dx,
const float hi, const float hj,
struct bpart *bi, const struct part *pj,
const struct xpart *xpj,
const struct cosmology *cosmo,
const struct gravity_props *grav_props,
const integertime_t ti_current) {
float wi, wi_dx;
......@@ -83,11 +85,13 @@ runner_iact_nonsym_bh_gas_density(
* @param ti_current Current integer time value (for random numbers).
*/
__attribute__((always_inline)) INLINE static void
runner_iact_nonsym_bh_gas_swallow(
const float r2, const float *dx, const float hi, const float hj,
const struct bpart *restrict bi, struct part *restrict pj,
struct xpart *restrict xpj, const struct cosmology *cosmo,
const struct gravity_props *grav_props, const integertime_t ti_current) {}
runner_iact_nonsym_bh_gas_swallow(const float r2, const float *dx,
const float hi, const float hj,
const struct bpart *bi, struct part *pj,
struct xpart *xpj,
const struct cosmology *cosmo,
const struct gravity_props *grav_props,
const integertime_t ti_current) {}
/**
* @brief Swallowing interaction between two BH particles (non-symmetric).
......@@ -108,8 +112,7 @@ runner_iact_nonsym_bh_gas_swallow(
__attribute__((always_inline)) INLINE static void
runner_iact_nonsym_bh_bh_swallow(const float r2, const float *dx,
const float hi, const float hj,
const struct bpart *restrict bi,
struct bpart *restrict bj,
const struct bpart *bi, struct bpart *bj,
const struct cosmology *cosmo,
const struct gravity_props *grav_props,
const integertime_t ti_current) {}
......@@ -129,11 +132,13 @@ runner_iact_nonsym_bh_bh_swallow(const float r2, const float *dx,
* @param ti_current Current integer time value (for random numbers).
*/
__attribute__((always_inline)) INLINE static void
runner_iact_nonsym_bh_gas_feedback(
const float r2, const float *dx, const float hi, const float hj,
struct bpart *restrict bi, struct part *restrict pj,
struct xpart *restrict xpj, const struct cosmology *cosmo,
const struct gravity_props *grav_props, const integertime_t ti_current) {
runner_iact_nonsym_bh_gas_feedback(const float r2, const float *dx,
const float hi, const float hj,
struct bpart *bi, struct part *pj,
struct xpart *xpj,
const struct cosmology *cosmo,
const struct gravity_props *grav_props,
const integertime_t ti_current) {
#ifdef DEBUG_INTERACTIONS_BH
/* Update ngb counters */
if (si->num_ngb_force < MAX_NUM_OF_NEIGHBOURS_BH)
......
......@@ -24,6 +24,7 @@
#include "hydro.h"
#include "random.h"
#include "space.h"
#include "timestep_sync.h"
/**
* @brief Density interaction between two particles (non-symmetric).
......@@ -40,11 +41,13 @@
* @param ti_current Current integer time value (for random numbers).
*/
__attribute__((always_inline)) INLINE static void
runner_iact_nonsym_bh_gas_density(
const float r2, const float *dx, const float hi, const float hj,
struct bpart *restrict bi, const struct part *restrict pj,
const struct xpart *restrict xpj, const struct cosmology *cosmo,
const struct gravity_props *grav_props, const integertime_t ti_current) {
runner_iact_nonsym_bh_gas_density(const float r2, const float *dx,
const float hi, const float hj,
struct bpart *bi, const struct part *pj,
const struct xpart *xpj,
const struct cosmology *cosmo,
const struct gravity_props *grav_props,
const integertime_t ti_current) {
float wi, wi_dx;
......@@ -121,11 +124,13 @@ runner_iact_nonsym_bh_gas_density(
* @param ti_current Current integer time value (for random numbers).
*/
__attribute__((always_inline)) INLINE static void
runner_iact_nonsym_bh_gas_swallow(
const float r2, const float *dx, const float hi, const float hj,
struct bpart *restrict bi, struct part *restrict pj,
struct xpart *restrict xpj, const struct cosmology *cosmo,
const struct gravity_props *grav_props, const integertime_t ti_current) {
runner_iact_nonsym_bh_gas_swallow(const float r2, const float *dx,
const float hi, const float hj,
struct bpart *bi, struct part *pj,
struct xpart *xpj,
const struct cosmology *cosmo,
const struct gravity_props *grav_props,
const integertime_t ti_current) {
float wi;
......@@ -231,8 +236,7 @@ runner_iact_nonsym_bh_gas_swallow(
__attribute__((always_inline)) INLINE static void
runner_iact_nonsym_bh_bh_swallow(const float r2, const float *dx,
const float hi, const float hj,
struct bpart *restrict bi,
struct bpart *restrict bj,
struct bpart *bi, struct bpart *bj,
const struct cosmology *cosmo,
const struct gravity_props *grav_props,
const integertime_t ti_current) {
......@@ -338,11 +342,13 @@ runner_iact_nonsym_bh_bh_swallow(const float r2, const float *dx,
* @param ti_current Current integer time value (for random numbers).
*/
__attribute__((always_inline)) INLINE static void
runner_iact_nonsym_bh_gas_feedback(
const float r2, const float *dx, const float hi, const float hj,
const struct bpart *restrict bi, struct part *restrict pj,
struct xpart *restrict xpj, const struct cosmology *cosmo,
const struct gravity_props *grav_props, const integertime_t ti_current) {
runner_iact_nonsym_bh_gas_feedback(const float r2, const float *dx,
const float hi, const float hj,
const struct bpart *bi, struct part *pj,
struct xpart *xpj,
const struct cosmology *cosmo,
const struct gravity_props *grav_props,
const integertime_t ti_current) {
/* Get the heating probability */
const float prob = bi->to_distribute.AGN_heating_probability;
......@@ -372,6 +378,9 @@ runner_iact_nonsym_bh_gas_feedback(
/* "We did some AGN heating! id %llu BH id %llu probability " */
/* " %.5e random_num %.5e du %.5e du/ini %.5e", */
/* pj->id, bi->id, prob, rand, delta_u, delta_u / u_init); */
/* Synchronize the particle on the timeline */
timestep_sync_part(pj);
}
}
......
......@@ -1993,6 +1993,9 @@ void engine_make_extra_hydroloop_tasks_mapper(void *map_data, int num_elements,
if (with_feedback) {
scheduler_addunlock(sched, t_star_feedback, ci->super->timestep_sync);
}
if (with_black_holes && bcount_i > 0) {
scheduler_addunlock(sched, t_bh_feedback, ci->super->timestep_sync);
}
}
}
......@@ -2190,6 +2193,9 @@ void engine_make_extra_hydroloop_tasks_mapper(void *map_data, int num_elements,
scheduler_addunlock(sched, t_star_feedback,
ci->super->timestep_sync);
}
if (with_black_holes && (bcount_i > 0 || bcount_j > 0)) {
scheduler_addunlock(sched, t_bh_feedback, ci->super->timestep_sync);
}
}
} else /*(ci->nodeID != nodeID) */ {
if (with_feedback) {
......@@ -2279,6 +2285,10 @@ void engine_make_extra_hydroloop_tasks_mapper(void *map_data, int num_elements,
scheduler_addunlock(sched, t_star_feedback,
cj->super->timestep_sync);
}
if (with_black_holes && (bcount_i > 0 || bcount_j > 0)) {
scheduler_addunlock(sched, t_bh_feedback,
cj->super->timestep_sync);
}
scheduler_addunlock(sched, t_limiter, cj->super->timestep_limiter);
}
}
......@@ -2457,8 +2467,10 @@ void engine_make_extra_hydroloop_tasks_mapper(void *map_data, int num_elements,
if (with_feedback) {
scheduler_addunlock(sched, t_star_feedback, ci->super->timestep_sync);
}
if (with_black_holes && bcount_i > 0) {
scheduler_addunlock(sched, t_bh_feedback, ci->super->timestep_sync);
}
}
}
/* Otherwise, sub-pair interaction? */
......@@ -2659,6 +2671,9 @@ void engine_make_extra_hydroloop_tasks_mapper(void *map_data, int num_elements,
scheduler_addunlock(sched, t_star_feedback,
ci->super->timestep_sync);
}
if (with_black_holes && (bcount_i > 0 || bcount_j > 0)) {
scheduler_addunlock(sched, t_bh_feedback, ci->super->timestep_sync);
}
}
} else /* ci->nodeID != nodeID */ {
......@@ -2752,6 +2767,10 @@ void engine_make_extra_hydroloop_tasks_mapper(void *map_data, int num_elements,
scheduler_addunlock(sched, t_star_feedback,
cj->super->timestep_sync);
}
if (with_black_holes && (bcount_i > 0 || bcount_j > 0)) {
scheduler_addunlock(sched, t_bh_feedback,
cj->super->timestep_sync);
}
scheduler_addunlock(sched, t_limiter, cj->super->timestep_limiter);
}
......
......@@ -22,8 +22,6 @@
/* Config parameters. */
#include "../config.h"
#include "kick.h"
__attribute__((always_inline)) INLINE static void timestep_sync_part(
struct part *p) {
p->to_be_synchronized = 1;
......@@ -35,6 +33,9 @@ __attribute__((always_inline)) INLINE static void timestep_sync_part(
#endif
}
#include "engine.h"
#include "kick.h"
INLINE static void timestep_process_sync_part(struct part *p, struct xpart *xp,
const struct engine *e,
const struct cosmology *cosmo) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment